Features of JavaScript — JS Technical Interview Questions & Answers
Dynamic typing, first-class functions, prototypes and more.
Features of JavaScript
- Dynamic typing, first-class functions, prototypes and more.
- JavaScript is the language that runs in the browser to make pages interactive: clicks, validation, fetch from an API. It is not Java. Node.js also runs JavaScript on the server, but this chapter is the browser first.
- Smallest program: in the console, or a <script>console.log('Hello JS')</script>. let total = 0; total = total + 1. Functions, arrays, objects, then DOM: document.querySelector('button').addEventListener('click', …).
- Trap: ‘Java and JavaScript are the same’. Trap: putting a huge script in <head> without defer so the page waits.
Technical Interview Tip: Not Java. console.log, then a button click.
Code Examples for Features of JavaScript
Features of JavaScript — working example
// JavaScript runs in browsers and Node.js
console.log("Hello, JavaScript!");
console.log(typeof "hi", typeof 42, typeof true);
function add(a, b) {
return a + b;
}
console.log(add(2, 3));Features of JavaScript — jS is a dynamic language for interactive web pages and servers; start with console + small functions.
How to Explain Features of JavaScript to an Interviewer
What is JavaScript?
Language in the browser (and Node) Not Java
First example?
console.log('Hello JS')