Day 1 of #100DaysOfCode
I’m going to jot down about my learnings in an defined approach by my blogs and socials. If you wish to be part of me on the training journey, be certain to comply with my blogs and social and share yours too. Let’s study collectively!🏼🏼
- The title should start with an alphabetical letter (from A to Z), an underscore (_), or a greenback signal ($).
- The primary letter might be adopted by any quantity from 0 to 9, corresponding to the worth 1.
const isLoggedIn = true;
We retailer values in one thing referred to as a variable.
const a = 5
Within the above code,
a is the variable. Quantity
5 is the worth to be saved in
const is a key phrase used to declare
A number of Variables
; at each assertion finish.
We will create one other variable to retailer the worth of the earlier variable.
const a = 5;
const b = a;
b will retailer the worth
const loggedIn = false;
If a person is logged within the above line, the
false indicated that they aren’t.
We will additionally retailer boolean values inside variables. If we’ve got to retailer
true in a single variable and
false in one other variable, then:
cont a = false;
const b = true;
' ' and double
Right here, we used double quotes so we may use a single quote contained in the message:
const message = "Whats up, hope you might be doing tremendous!" ;
If we would have liked to make use of double quotes:
const message = 'Then he stated, "Hey, are you coming dwelling?"';
If we would have liked to make use of a double quote inside double quote string, we are able to use a backslash
as an escape character:
const message = "That is double-quote " inside double-quotes";
Strings are nothing however a bunch of characters (
c) put collectively.
const a = "Whats up!";
anotherNamemakes use of two various kinds of quotes, single and double. We will use both one or inside one another.
const myName = 'Anand';
const anotherName = "Vishal";
Now have a look at the third technique to declare strings:
const helloMessage = `Whats up $myName, my title is $anothername!`;
helloMessage variable makes use of backticks
` . With backticks, we are able to add values contained in the strings. The
$variable is about this. Within the above line of code, we’re taking worth from
anotherName and putting them into strings. The variable
helloMessage now comprises
"Whats up Anand, my title is Vishal!"
const SERVER_KEY_VALUE = "abcdefg"; This casing is usually reserved for atmosphere variables or values which might be wanted to be decided earlier than code executions. Like, in case you have some secret key that you just wish to retailer on the server however not on the native machine, then You may preserve that variable tucked away on the server in an atmosphere variable that may require permissions to entry or change. These are the sorts of variables we’ll typically see with this casing.
If You ❤️ My Content material! Join Me on Twitter or Helps Me By Buying Me A Coffee☕
Additionally Printed Here
L O A D I N G
. . . feedback & extra!
Leave a Reply