What is JavaScript?
JavaScript and Java are completely different languages, both in concept and design.
JavaScript was invented by Brendan Eich in 1995, and became an ECMA standard in 1997.
ECMA-262 is the official name of the standard. ECMAScript is the official name of the language.
Why learn JavaScript?
JavaScript is one of the 3 languages all web developers must learn:
1. HTML to define the content of web pages
2. CSS to specify the layout of web pages
3. JavaScript to program the behavior of web pages
Advantages of JavaScript :
Regardless of where you host JavaScript, it always gets executed on client environment to save lots of a bandwidth and make execution process fast.
In JavaScript, XMLHttpRequest is an important object that was designed by Microsoft. The object call made by XMLHttpRequest as a asynchronous HTTP request to the server to transfer the data to both sides without reloading the page
The biggest advantage to JavaScript having a ability to support all modern browsers and produce an equivalent result.
Global companies support community development by creating projects that are important. An example is Google (created Angular framework) or Facebook (created the React.js framework).
JavaScript is employed everywhere on the web .
JavaScript plays nicely with other languages and may be utilized in an enormous sort of applications.
There are many open source projects that provide a useful help at the developer’s add JavaScript.
There are many available courses within the field of JavaScript, because of which you’ll quickly and simply expand your knowledge of this programming language.
It is not difficult to start working in JavaScript. For this reason, many of us prefer to start their adventure with the IT sector from learning this language.
It gives the power to make rich interfaces.
There are some ways to use JavaScript through Node.js servers. It is possible to develop a whole JavaScript app from front to back using only JavaScript.
Disadvantages of JavaScript :
This may be difficult to develop large applications, although you’ll also use the TypeScript overlay.
This applies to larger front-end projects. The configuration is often a tedious task to the amount of tools that require to figure together to make an environment for such a project. This is often directly associated with the library’s operation.
The main problem or disadvantage in JavaScript is that the code is always visible to everyone anyone can view JavaScript code.
No matter what proportion fast JavaScript interpret, JavaScript DOM (Document Object Model) is slow and can be a never fast rendering with HTML.
If the error occurs in the JavaScript, it can stop to render the whole website. Browsers are extremely tolerant of JavaScript errors.
JavaScript is usually interpreted differently by different browsers. This makes it somewhat complex to read and write cross-browser code
IThough some HTML editors support debugging, it’s not as efficient as other editors like C/C++ editors . Hence difficult for the developer to detect the matter .
This continuous conversions takes longer in conversion of number to an integer. This increases the time needed to run the script and reduces its speed.
What To Avoid in JavaScript :
Avoid creating a new object by using new Object(). Use the object literal syntax {} instead.
Same thing for arrays, favor [] over new Array().
Avoid blocks except where statements require them (if, switch, loops, try).
Never assign inside an if of while statements condition part
Never use == and !=. Use === and !== instead.
Never use eval. Why? It has performance issues (it runs the interpreter /compiler), it has security issues (code injection if used with user input), difficulties in debugging.
Never use with, as it modifies the scope chain and can be a source of confusion.
Always pass functions to setTimeout and setInterval
Never use Array as an associative arrays, use Object instead. The part of the Array object that provides that functionality is in fact provided by the Object prototype, so you could really have used a Date object for that same thing.
Don’t use \ at the end of a string to create a multiline string, it’s not part of ECMAScript. Use string concatenation ' string1 ' + ' string2 ' instead
Never modify the prototypes of the built-in objects Object and Array. Modify other prototypes of other objects such as Function with caution as it could lead to bugs hard to debug.