Combined Discussion with JavaScript

Warid Bin Azad
3 min readMay 6, 2021

After Reading and analysis some blogs, I made a summary among them.

  1. Codding Style Syntax:
    It is very important for a programmer write his code clean and understandable. It is also known as an art of programming. The complex code isn’t helpful for developer’s as because when he read his code for finding some error he become confused and frustrated. So codding styles is very important for a serious developer.
    Here some rule is guven bellow :
    · A space between parameters like
    function pow(x, y);
    · No space between the function name and parentheses between the parentheses and the parameter
    · A semicolon ; is mandatory
    · Spaces around operators
    · Curly brace { on the same line, after a space
    · A space between parameters
    · A space after for/if/while…
    · Use else without a line break
    · Spaces around a nested call
    · An empty line between logical blocks
    · Lines are not very long
  2. Primitive Values:
    Primitive values are things like numbers, strings, boolean, and undefined. They’re simple (primitive) in the sense that they are the type of data value that don’t contain properties. Example:
    true;
    “hello”;
    3.14;
    null;
    undefined;
  3. Error handling, “try…catch”:
    The code statements which we want to execute, are kept inside the try block, followed by a catch block.
    try
    {
    // code that can cause an error
    }
    catch(err)
    {
    // what to do when an error occurs
    }
  4. Custom Error:
    If you wanted to dive into the world of custom error handling with JavaScript, you can do so by creating your own custom errors. These will allow you to describe your errors specific to the application you are developing.
    Example:
    const person = {
    name: “Abrar”,
    age: 24
    }
    function webDeveloper(w){
    if(w.age < 26){
    throw new Error(‘person is under age’); //custom Error
    }
    console.log(`${w.name} is a developer`);
    }
    try {
    webDeveloper(person);
    } catch (error) {
    console.log(“error found”);
    console.log(error);
    }
  5. Functions with Default Parameter Values:
    JavaScript allow us to initialize parameter a default value. If you are not passing any value to the parameter, then the default value of the parameter will be undefined. ES6 has introduced a default parameter feature, in which it allows us to set default value to the parameter of a function.
    Example:
    function addition(num1, num2 = 0) {
    if(num1 === undefined){
    num1 = 10;
    }
    return num1 + num2;
    }
    addition();
  6. Client cache vs Server cache:
    Server side caches are generally used to avoid making expensive database operations repeatedly to serve up the same content to lots of different clients.
    Client side caches are used to avoid transferring the same data over the network repeatedly.
  7. Cross-Browser Testing:
    we conduct browser compatibility testing of your website across various browsers like Chrome, Safari, Internet Explorer, Firefox, etc. We use both manual and automated tools to perform the testing and ensure your web applications work flawlessly across all the popular browsers.
    cross-browser testing can be mostly mechanized and consolidated into persistent testing for speedier or more exact comes about. A browser test computerization apparatus loads a location on a number of browsers, and after that checks within the code to the nonstop testing workflow when it passes the desired tests. A fizzled test makes a criticism circle. Computerized cross-browser tests frequently depend on headless browsers, which empower speedier tests as no visuals stack.
  8. Spread operator:
    the spread operator is to spread the elements of an array or object. examples.
    const array = [‘A’, ‘B’, ‘C’, ‘D’, ‘E’]
    const [first, second, …rest] = array
    console.log(first)
    // A
    console.log(second)
    // B
    console.log(rest)
    // [‘C’, ‘D’, ‘E’]
  9. Arrow function
    Arrow functions are always anonymous and effectively turn function (arguments) { expression } into arguments => expression. If using an expression after an arrow, the return is implicit, so no return is required.
    Example: const myFunction = () => {
    //…
    }
  10. Hoisting Variables:
    One of the key aspects of hoisting is that the declaration is put into memory — not the value.
    Let’s see an example:
    console.log(name); // Prints undefined, as only declaration was hoisted
    var name = “John”;
    console.log(name); // Prints “John”
    This happens because JavaScript sees that we have a variable name in the scope and puts it into memory. Variables declared with var are given a value of undefined until they are assigned something else.

--

--

Warid Bin Azad
0 Followers

Web Developer, Engineer, Programmer