Important of Javascript
1. javaScript data type
the javascript data type is two types. primitive value and object and function. primitive types are 9 separate. number, string, boolean, object, function, etc. some are rarely used.
the null and undefined value is lonely. and every time you can find out every number, string boolean or etc. uses by javascript console. example: consol.log(typeof(2)) // number, consol.log(typeof(‘hello’)) // string.
2. error handle try…catch
every programmer should know to try and catch or error handling. if the client wrong input or programmer code mistake then this mistake handles the catch block. otherwise, try block run the code. when try block running when catch block ignored. after that catch block running when try block ignored.
3. code quality beautiful
always code has clean because code read too easy. after white space every parameter. function same line includes curly brace. every operator's space around. space between argument. else without a line break. always every logical time has one empty line. that will be clean code.
4. comment in js
every programmer used comment of code. comment system is various type. single-line comment uses before // and multiple line comment uses /**/ multiple line before /* then ending code */; I mean multiple line comment /*……code…..*/
5. cross browser
web site not working every browser. some bugs fix then supported maximum browser of your web site. that's why every time makes sure to test for your website cross browsing as a developer. first, fix your code then test for some browsers like safari, opera, Edge, desktop (Mac, Windows, and Linux, ideally).
6. var declaration
if you write the var in function in if block then this is just used if block. not use else or enclosing block but var use to globally or inside the function but upper level than that var uses to any place. because this is globally declared. var is globally or functionally scoped.
7. let and const declare
es6 new feature is let and const. let variable declare then every place to call not possible because this is block scope. and const is a constant variable. this assigned value but then const value will not change.
8. block binding in loops
javascript loop uses the various system. for loop, while loop and es6 feature is forEach loop. every loop uses by var, let, and const. so all loop uses by block scope binding.
9. Emerging Best Practices for Block Bindings
before var variable work and now work same. and let is block scope. const is block scope but const value not changeable. when you will change the const value then that is the source of bugs. it is an es6 feature. and this is famous for in javascript.
10. Functions with Default Parameter Values
when we use function and two-parameter then we will pass two-parameter. but sometimes if we will pass one parameter then this function not work. that's why the function parameter set the default value.
EXAMPLE:
function multiply(x, y = 1) {
return x * y;
}console.log(multiply(6, 6));
// expected output: 36console.log(multiply(6));
// expected output: 6
11. Working with Unnamed Parameters
setInterval and setTimeout and some places use by anonymous function. this is the unNamed parameter. but this is a function and behaver function.