Q631. What is the purpose of dir method of console object?
The `console.dir()` is used to display an interactive list of the properties of the specified JavaScript object as JSON. ```javascript const user = { name: "John", id: 1,...
Technical Question Bank · Peer-Reviewed
Search and filter frequently asked interview questions across technical, programming, and behavioral domains. Tailor your interview preparation by difficulty for freshers or experienced developers (780 available).
The `console.dir()` is used to display an interactive list of the properties of the specified JavaScript object as JSON. ```javascript const user = { name: "John", id: 1,...
Yes, it is possible to get and debug HTML elements in the console just like inspecting elements. ```javascript const element = document.getElementsByTagName("body")[0]; c...
The `console.table()` is used to display data in the console in a tabular format to visualize complex arrays or objects. ```js const users = [ { name: "John", id: 1, city...
The combination of IsNaN and isFinite methods are used to confirm whether an argument is a number or not. ```javascript function isNumber(n) { return !isNaN(parseFloat(n)...
You can _decorate_ your _class_ components, which is the same as passing the component into a function. **Decorators** are flexible and readable way of modifying componen...
You need to select the content(using .select() method) of the input element and execute the copy command with execCommand (i.e, execCommand('copy')). You can also execute...
You can use `new Date().getTime()` to get the current timestamp. There is an alternative shortcut to get the value. ```javascript console.log(+new Date()); console.log(Da...
Flattening bi-dimensional arrays is trivial with Spread operator. ```javascript const biDimensionalArr = [11, [22, 33], [44, 55], [66, 77], 88, 99]; const flattenArr = []...
You can use `indexOf` to compare input with multiple values instead of checking each value as one condition. ```javascript // Verbose approach if ( input === "first" || i...
The `beforeunload` event is triggered when the window, the document and its resources are about to be unloaded. This event is helpful to warn users about losing the curre...
HireXTech uses essential storage to remember your study preferences and third-party advertising cookies via Google AdSense in compliance with GDPR. You can choose to enable essential cookies only or accept all cookies. Read our Privacy Policy.