DEV Community

front_end_shifu_2022
front_end_shifu_2022

Posted on

Js fundementals

Tips:
primitive data type:
assigning to primitive data type any changes are made directly to that value.
non-primitive data-type:
assigning non-primitive value to variable is done by reference ,so any changes will affect all the references.

Difference between undefined and null:
both represent no value
undefined : javascript cant find value for this.
null: Programmer set the values.

let number1 = undefined-20; //undefined to NAN
console.log(number1);//NaN

let number2 = 20 + null; ///null to 0
console.log(number2);//20

strings:
There are three types of strings
1) double quotes:"Hello"
2) single quotes:'Hello'
3) backticks:`Hello'

double quotes and single quotes are simple quotes.There's practically no difference between them in javascript.
example:
console.log('my name is "john".');
console.log("my name is 'john'.");

backticks are "extended functionality quotes. They allow us to include variable and expression into string by wrapping it in ${...}.
for example;
let name="scolfield";
console.log(your name is ${name})

Thanks for reading.

Top comments (0)