- Jaimin Gohel
Survey by stackoverflow.com
JavaScript is a lightweight, interpreted programming language.
Increased interactivity for users.
Complementary to and integrated with HTML.
Open and cross-platform.
It’s a syntantically simple language.
Extensible - Javascript can be coupled with many powerful tools that give it a ton of utility: JSON, AJAX, Nodejs, MongoDB, jQuery.
Its Everywhere!
Code re-usability(Third-party modules)
jQuery, React, Vue.js, Moment.js
Bad security practices
somediv.innerHTML= '<p>Hello, '+name+'</p>';
77% of 433,000 Sites Use Vulnerable JavaScript Libraries
Source: https://snyk.io
Libraries with no known vulnerabilities
Source: https://snyk.io
Client-side
DOM-based cross-site scripting (XSS)
Client-side logic and data storage
Avoid setInnerHtml() and .innerHtml =. Instead, use setInnerText() or DOM-based operations (to make sure you don't introduce script tags, i.e., to avoid DOM-based XSS). Avoid document.write().
Avoid eval(). Its use tends to be correlated to security flaws. Similarly, avoid other APIs that turn a string into code and execute it, like setTimeout() with a string argument, setInterval() with a string argument, or new Function().