How to Create Objects In JavaScript?
In JavaScript, almost “everything” is an object. Booleans can be objects (if defined with the new keyword) Numbers can be objects (if defined with the new keyword) Strings can be objects (if defined with the new keyword) Dates are always objects Maths are always objects Regular expressions are always objects Arrays are always objects Functions are always objects Objects are always […]
Navigator in JavaScript
The window.navigator object contains information about the visitor’s browser. Window Navigator The window.navigator object can be written without the window prefix. Browser Platform Browser Language Is The Browser Online? Warning !!! The information from the navigator object can often be misleading, and should not be used to detect browser versions because: Different browsers can use […]
How To Calculate The Execution Time Of The Code In JavaScript
Measuring the execution times of a code snippet can be essential as a form of debugging, especially when some other component is time-dependent on that piece of code for its execution (e.g. animations). There are mainly three ways in which this can be done: 1. Using Date.now() The static Date.now() the method returns the number of milliseconds […]
How can I remove a specific item from an array?
Question: I have an array of numbers and I’m using the .push() method to add elements to it. Is there a simple way to remove a specific element from an array? Answer : Find the index of the array element you want to remove using indexOf, and then remove that index with splice. Basic Concepts The second parameter of splice is […]
What is JavaScript?
What is Javascript? JavaScript is a lightweight, interpreted programming language. It is designed for creating network-centric applications. It is complementary to and integrated with Java. JavaScript is very easy to implement because it is integrated with HTML. It is open and cross-platform. Why Learn Javascript? Javascript is a MUST for students and working professionals to become great Software Engineers especially when […]