Web Development Articles - Page 567 of 1049

How to Clear the JavaScript Console in Google Chrome

Aman Kumar
Updated on 19-Dec-2022 12:05:07

16K+ Views

In this article we are going to learn how to clear the JavaScript Console in Google Chrome. We have various methods to clear the console; but our question is why do we need to clear the console? Sometimes we have lots of commands and logs printed in any browser console which makes it look substandard and packed with output. So, we need to clear the console. And there are multiple ways to clear the console of google chrome. Using the console.clear() method This method will clear the console and display the message on the console that the console was clear. ... Read More

Dynamically creating keys in JavaScript associative array

Aman Kumar
Updated on 19-Dec-2022 12:01:59

4K+ Views

In this article, we are going to discuss how to create keys in a JavaScript associative array dynamically. Associative arrays are dynamic objects that are user defined as needed. When you assign values to keys in a variable of types array, then the array is transformed into an object, and it loses the attributes and methods or array. i.e. the length attributes have no effect because the variables are no longer of the type array. JavaScript associative arrays are same as any other literals. You can add keys to these using the square brackets notation you can add keys to ... Read More

Why Ember.js is the best javascript frame work?

Aman Kumar
Updated on 19-Dec-2022 11:58:06

243 Views

Ember.js is the best framework. The user of Ember.js is increasing day by day. The popularity of ember.js is 6.3% of JavaScript developers currently using ember. Its popularity has stood over the last two years. Ranked 4th most popular JavaScript framework. Ember.js is an MVVM (Model−view−view−model) model framework for complex and multiple-page applications and it is an open-source framework. It is a very redefined control system that helps you to integrate with the new version without any problems. Ember.js is a free javascript client-side framework it is used for developing web applications. It is providing the complete solution which contains ... Read More

How to set a countdown timer in javascript?

Aman Kumar
Updated on 19-Dec-2022 11:36:37

9K+ Views

We can set a countdown timer in JavaScript using the setInterval() method. This method continuously calls a function or executes a code snippet with a fixed time delay between every call. The setInterval() method calls a function at described intervals in milliseconds. It continues calling the function until the clearInterval() is called, or the window is closed. SyntaxFollowing is the syntax of this method − setInterval(function, milliseconds); The setInterval method accepts two parameter functions and milliseconds. function − A function containing a block of code designed to perform a particular task. milliseconds − it is the time interval ... Read More

How to do image preloading with javascript?

Aman Kumar
Updated on 19-Dec-2022 11:41:43

1K+ Views

The preload attribute specifies how the author thinks about the media file should be loaded when the page loads. The preload attributes allow the author to provide hints to the browser about how much time should take to load a page, it will lead to the best user experience. Preload also tells the browser about critical resources that you want to load as soon as possible. This is especially useful for resources that are not easily appreciable, such as fonts included in stylesheets, background images, or resources loaded from a script. Using preload helps here because the images start loading ... Read More

How to get the size of a json object in JavaScript?

Aman Kumar
Updated on 19-Dec-2022 11:33:57

10K+ Views

In this article, we will learn about various methods to get the size of a JSON object in JavaScript. Getting the size of the object in JavaScript is same as the counting the total number of keys of an object. In general, we can get the size or number of keys of a JSON object in JavaScript by using two methods. Using object.keys() The object.keys() method returns an array of the given object of its countable properties name with the same order as we get as a normal loop. Following is the syntax of this method − Object.keys(name_of_object).length; ... Read More

How do I add a class to a given element using Javascript?

Aman Kumar
Updated on 19-Dec-2022 11:31:44

936 Views

In JavaScript, there are various approaches to add a class to an element. We can use the .className attribute or the .add() method to add a class name to the specific element. The class attribute can be used in CSS to perform some tasks for the elements with the parallel class name. Using the className Property We can use this property to add a class to an HTML element without restoring its existing class. This property can be used to execute the value of the class attribute of an element. If a class is already declared for an element, ... Read More

Javascript Map vs Object — What and when?

Aman Kumar
Updated on 19-Dec-2022 11:26:09

368 Views

The JavaScript Map is the data structure that helps us to store the data in the form of pairs. The pairs consist of a unique key and value mapped to the key. It helps to prevent duplicity. The JavaScript Object also follows the same concept as that of a map i.e. key−value pairs for storing data. But there are slight differences that make the map a better performer in certain situations Let us look into these differences between a Map and an Object further in this article. Map vs Object Following are the major differences between Map and Object ... Read More

Is it possible to change values of the array when doing foreach() in javascript?

Abdul Rawoof
Updated on 02-Sep-2022 11:38:10

6K+ Views

Array is a data type which can store multiple elements of similar data types. For example, array is declared as integer data type then it stores one or more elements of the integer data type. In arrays the element can be manipulated when they are in a loop by using any of the mathematical operations or so. For example, if the array elements are numbers, then the numbers can be multiplied by a fixed number or can be added or subtracted also. The change in the array elements can be done by using a user defined program and the result ... Read More

How to deserialize a JSON into Javascript object?

Aman Kumar
Updated on 19-Dec-2022 11:12:58

3K+ Views

Serialization is the process of converting an object such that it is transferable over the network. In JavaScript usually we serialize an Object into the JSON (or JavaScript Object Notation) format. To reserialize a JSON into a JavaScript object, we need to use the method JSON.parse(). JavaScript object notation is used to exchange data to or from a web server of the rest full API. The data we get from a web server is always a string variable, in order to use it we need to parse it with JSON.parse() which will return a JavaScript object or array object. Following ... Read More

Advertisements