Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
May 25, 2021 11:48 am GMT

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.


Original Link: https://dev.to/front_end_shifu_2022/js-fundementals-4j58

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To