Advance javascript and Es6 some important topics.
NO-1. try…catch
Description:
When writing code,it is often not clear where the error is coming from.The tri…catch code easily shows where the error is.Errors can be detected by placing the original code in the tri-block.
Example :
NO-2. Arrow-function
Description:
Arrow functions were introduced in ES6.One reason arrow functions were introduced was to alleviate scope ( this
) complexities and make executing functions much more intuitive.
Example :
NO-3. Spread Operator
Description :
The data of an array or object can be used in any other function through the spread operator only by typing (…) and the name of that array or object.
Example :
No-4.Var Declarations and Hoisting
Description :
Variable declarations using var are treated as if they are at the top of the function (or global scope, if declared outside of a function) regardless of where the actual declaration occurs; this is called hoisting
Example :
NO-5. Block-Level Declarations:
- Inside of a function
2.Inside of a block { \\code block }
Example :
NO-6. Functions with default parameter values.
Description
In JavaScript, function parameters default to undefined
. However, it's often useful to set a different default value. This is where default parameters can help.
Example :
NO-7. Types in Javascript
Description:
JavaScript has six primitives types: string
, number
, undefined
, null
, boolean
, and symbol
. There is also a compound type or object
. Interestingly, the primitive types are immutable and don't have properties.
No-8.Destructuring assignment
Description
The object and array literal expressions provide an easy way to create ad hoc packages of data.
Example :
NO-9.Template literals (Template strings)
Description
Template literals are enclosed by the backtick (` `) (grave accent) character instead of double or single quotes.
Example :
`string text line 1
string text line 2`
NO-10. Async…Await
Description :
Async functions can contain zero or more await
expressions. Await expressions suspend progress through an async function, yielding control and subsequently resuming progress only when an awaited promise-based asynchronous operation is either fulfilled or rejected.
Example :