The ________ initiative aimed to standardize the core features of JavaScript.
- ECMAScript
- JavaScriptCore
- JSStandard
- WebScript
The ECMAScript initiative aimed to standardize the core features of JavaScript. ECMAScript defines the language specification that JavaScript implementations, such as those in web browsers, must adhere to. It ensures consistency and compatibility across different environments.
Which technology was NOT directly influenced by JavaScript's development?
- JSON (JavaScript Object Notation)
- Java
- Node.js
- jQuery
While JavaScript and JSON share a similar name, JSON (JavaScript Object Notation) is a data interchange format and not a technology directly influenced by JavaScript's development. Java, Node.js, and jQuery, on the other hand, are technologies that were influenced or built upon JavaScript.
How to declare a block-scoped variable in JavaScript?
- var keyword
- const keyword
- let keyword
- block keyword
In JavaScript, you can declare a block-scoped variable using the let keyword. Variables declared with let are limited in scope to the block, statement, or expression in which they are defined. This helps prevent unintended variable hoisting and allows you to create variables with localized scope within functions or blocks. var is function-scoped, and const is used to declare constants. block is not a valid keyword for variable declaration.
The querySelector method uses _______ selectors to select elements.
- CSS
- XPath
- JSON
- HTML
The querySelector method uses CSS selectors to select elements in the DOM. You can use CSS selector syntax to specify the elements you want to select, making it a powerful tool for finding and manipulating DOM elements based on their attributes and structure.
Which of the following is NOT a primitive data type in JavaScript?
- Object
- Number
- String
- Function
In JavaScript, primitive data types include Number, String, Boolean, Null, Undefined, and Symbol. Object is not a primitive data type; it is a reference data type that can hold collections of key-value pairs or functions. Primitive data types are immutable, whereas objects are mutable.
How does the pop() method behave when applied on an empty array?
- It returns undefined and does nothing
- It throws an error
- It removes the last undefined element and returns it
- It returns null
When the pop() method is applied to an empty array in JavaScript, it returns undefined and does nothing to the array. There are no elements to remove, so it simply returns undefined without causing any errors.
Which method is used to convert a JSON response to a JavaScript object?
- parseJSON()
- toJSON()
- JSON.parse()
- stringifyJSON()
The correct method to convert a JSON response to a JavaScript object is JSON.parse(). JSON.parse() parses a JSON-formatted string and turns it into a JavaScript object. It's commonly used when dealing with data received from APIs or when working with JSON data in JavaScript applications.
Which object is heavily used in AJAX to interact with server-side data?
- XMLHttpRequest
- JSON
- DOM
- Console
XMLHttpRequest is a crucial object used in AJAX (Asynchronous JavaScript and XML) to make HTTP requests to the server and interact with server-side data without requiring a page reload. It allows for asynchronous communication with the server, making web applications more dynamic and responsive.
What is the impact on performance when using a while loop with a condition that evaluates an expression involving function calls?
- High performance impact
- Moderate performance impact
- Low performance impact
- No performance impact
Using a while loop with a condition that involves function calls can have a moderate performance impact. This is because the function calls are evaluated in each iteration, potentially incurring additional processing overhead. It's important to optimize such code to minimize performance issues.
To select elements with a specific class name, you should use the __________ method.
- getElementById()
- getElementByClass()
- querySelectorAll()
- querySelector()
To select elements with a specific class name, you should use the querySelector() method. This method allows you to select elements using CSS-like selectors, including class names. For example, document.querySelector('.classname') selects all elements with the specified class name.