10 useful js features that you should know.

lets start —

1)Primitve data-

in js , primite data is not an object and has no methods . there are 7 priminte data types.

they are -

2)Checking a Type

by using typeof operator ,you can check the types

just like this -

3) functions with default parameter-

a default argument is a value that is automatically assigned by the computer if we don’t provide a value for the argument with a default value.

here is the example —

in this above code , b=1 is default parameter. if we don’t provide any value for b it will automatically assigne as b=1 that is called default parameter.

4)Arrow Functions-

arrow function is one of the features of es6 . es6 is a version of js. it allows us to create functions in a cleaner way compared to regular functions.

lets see the code ..

5)let and const Variables

The let statement declares a block scope local variable, optionally initializing it to a value.

we can change variable values when we use let

just like this -

but, if we use const , we cann’t change variable values.

just do it-

so, if we need to change the value anytime , than we use let and if we need to declear a specific values that never change , we will use const .

___________that’s for today. thank you

Web developer | programmer | learner