But we can change the order with parentheses ()
Strings and Template Literals
String is
a data type, which is a value. We store strings to a variable with quotes,
single quotes and backticks
Single
quotes
var book = 'Halol Luqma';
Double quotes
var followers = "Double quotes";
Backticks
Which one should i use? Here i am gonna explain to u
1. Case:
If you use Backtics
Well with using backticks u dont have to worry about
single and double quotes cos
it is gonna be ok
😊No errors!
Template Literal
Below in that picture you will see the power of Template literals
If else statement
IF
else
again in above picture you can see the
power of template literals
so the else statement is an optional, you can use acording to the situation.
else if
So if you have multiple statements to compare you can use else if as many times
Type
Conversion
As you can see in below picture it is concatinating.
We manually converted here:
Well, well, well, here is the interesting part, hope you realized:(in case, u didnt
realize,
it didnt convert deeply, it is still a string)
Here you cannot do this, as you know it is meaningless even converting string into
number:
You
can convert Number into String, if you need ofcourse :
Type Coersion
In above and in below picture the Javascript automatically converting the type of
values:
So if you remember only + addition concatinates
strings but when it comes to
other operators it simply does arithmatic, it is no longer string, it is number:
Do'stlaringiz bilan baham: