JavaScript Interview Questions

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

What's the difference between Scripting languages and programming languages (compiled and Interpreted)?

All scripting languages are programming languages. - scripting languages are interpreted and do not require the compilation before runtime. Code is compiled line by line during runtime. It makes it slower, because every time there is an error, code stops - Compiled languages run faster that interpreted because they are converted into native machine code before runtime and report all the issues at once.

How to read the properties of an object in JacaScript?

Can write and read properties of an object using the dot (.) notation.

What is undefined?

Default value of a variable that has not been assigned a specific value yet.

What is JavaScript?

JavaScript is both a client-side and server side interpreted (scripting) programming language that conforms to the ECMAScript specification.

What is ECMA 6 (ES6, ES2015, and ECMAScript 2015)?

It is the sixth edition of the ECMA-262 standard, and features major changes and improvements to the ECMAScript specification

What is JavaScript runtime?

JS runtime refers to the environment where JS code is executed when its run. For example, for the frontend - browser; backend - node.js

What is Babel?

Some browsers do not fully support features from the ES6 specification. Babel is a transcompiler that is used to convert ES6 code to ES5 so it can be run without any issues.

What is Null?

Value that represents no value.

What are JS data types?

- Boolean - Object - Undefinded - Null - String - Integer - Symbol

What is ECMAScript?

- ECMA international - organization that creates standards for technologies - ECMA-262 - Standard that represents a scripting language specification called ECMAScript - ECMAScript - Provides the rules, details, and guidelines that a scripting language must observe to be considered ECMAScript compliant. Guideline to create a scripting language.

What is the difference between JavaScript and Typescript?

- JavaScript is a scripting language which helps you create interactive web pages; does need to be compiled - Typescript is a superset of JavaScript, introduced in 2012 by Microsoft; needs to be compiled

What is the difference between JavaScript and Java

- JavaScript: Netscape, 1995; scripting language; interpreted; single-threaded (asynchronous); web applications - Java: Sun, 1995; programming language; compiled; multi-threaded (synchronous); OOP; android apps, enterprise apps, hardware, big data analytics

What are the advantages of using JavaScript?

- Less server interaction - Increased interactivity - Richer interface

What are the disadvantages of using JavaScript?

- Unable to support Networking applications - Single-threaded

What is the difference between undeclared and undefined?

- Undeclared variables are those that do not exist in a program and are not declared. If the program tries to read the value of an undeclared variable then a runtime error is encountered - Undefined variables are those that are declared in the program but have bot been given any value. If the program tires to read the value of an undefined variable, an undefined value is returned.

What are some JS object iteration methods?

- for...in - .map() - .find() returns 1st element that evaluates to true - .filter() returns all element that evaluate to true - .reduce() returns single value

What is JavaScript Engine?

A program or interpreter that understands and executes JavaScript code. JavaScript engines are commonly found in web browsers. Browsers can understand JavaScript code, but their performance is different because its JavaScript engine is implemented more or less efficiently. 2 phases: - Compilation: allocates memory and sets up references to identifiers - Execution: identifiers resolution: assigns values to variables and invokes functions.

What is prototype of an object?

Blueprint of an object. It is user as a fallback for properties and methods if it does exist in the current object. It's the way to share properties and functionality between objects. It's the core concept around JavaScript's Prototypal Inheritance. const o = {} console.log(o.toString()); // logs [object object]

What is the difference between JavaScript and Jscript

Both are similar. JS is developed by Netscape and Jscript was developed by Microsoft

When was JavaScript created?

In 1995 by Netscape for their Navigator Browser, by Brendan Eich.

What are ES6 modules?

Modules let us split our code base into multiple files for more maintainability and this lets us avoid putting all of our code in one big file. Uses import and export export function isNull(val){ return val === null; }

What is NaN?

Not a number. When JS is unable to perform operation on not a number. - NaN's data type is a number

What is Object Destructuring?

Object destructuring is a new and cleaner way of getting or extracting values from an object or an array. let firstName = employee.firsName let lastName = employee.lastName VS let { firstName, lastName, position, yearHired } = employee;

What is an Object?

Object is a key/value pair. All keys are strings. Values can be anything. Create: ( -Literals: let object = {}; -Constructor: let object = new object({}) ) Add: ( - object.band = 'Led Zepplin' - object['band'] = 'Led Zepplin' - Object.assign({}, {band: 'Led Zepplin'}) - this is the non destructive method ) Edit: ( - object.band = 'Green day' - Object.assign({}, {band: 'Green day'}) - non destructive ) Delete: - delete object.band Access: - object['band'] - object.band

What does the new keyword do?

The new keyword is used with constructor functions to make objects in JavaScript.


Set pelajaran terkait

Gouwens Honors American Studies Semester 2 Final

View Set

Chapter 2 Cell Structure and Function

View Set

3.3/3.4 Bootstrap Confidence Intervals (Exam 2)

View Set

people in french (Fluent forever 625 words)

View Set

Exam FX Insurance , Chapter 3 : Life Insurance _ Basic

View Set

ECON345 Final Practice Questions by Khan

View Set

AP Physics 1 - Final Exam 23'24'

View Set

Chapter 5 Nail Structure & Growth

View Set

chapter 22 caring for the child with a psychosocial or cognitive condition

View Set