Front End Technology Articles

Page 238 of 652

Retrieve element from local storage in JavaScript?

Lokesh Yadav
Lokesh Yadav
Updated on 09-Dec-2022 7K+ Views

Let us discuss how to retrieve element from local storage with suitable examples in Javascript. To retrieve elements from the local storage in Java Script, we use getItem() method which helps us to access elements that are stored in the local storage object. The getItem() method belongs to the storage object. It can be a local storage object or a session storage object. The data that is stored inside the local storage is non-volatile storage. Even if we run out of the session time in a browser or if we close the browser, the data gets stored in the local ...

Read More

Getters and setters in JavaScript classes?

Lokesh Yadav
Lokesh Yadav
Updated on 09-Dec-2022 6K+ Views

In this article we are going to discuss about the getters and setters in JavaScript classes with suitable examples in JavaScript. In JavaScript, getters and setters are the methods that are used to get or set the value for properties. When using getters and setters, you can ensure higher data quality. Getters and Setters provide a simplified syntax for an object's properties and methods. Getters and Setters are used for Data Encapsulation. To add getters and setters in the class, use the get and set keywords. To get a better understanding let’s look into the syntax and usage of both ...

Read More

Another method other than a constructor in a JavaScript class?

Lokesh Yadav
Lokesh Yadav
Updated on 09-Dec-2022 281 Views

In this artcle we are going to learn another method other than a constructor in a JavaScript class with suitable examples in JavaScript The Constructor is used to create and initialize an instance of a class i.e., object. The constructor's job is to build a new object and set values for any attributes that already exist on the object. Every class has a default constructor. If we don’t provide our own constructor, then the default constructor will be incoked. Let’s understand this concept in a better way with the help of suitable examples further in this article. Syntax The syntax ...

Read More

How to convert JavaScript objects to primitive data types manually?

Lokesh Yadav
Lokesh Yadav
Updated on 09-Dec-2022 703 Views

In this article we are going to discuss how to convert JavaScript objects to primitive data types manually with suitables examples in JavaScript. Primitive data types are nothing but a string, number, boolean, etc. To convert objects to primitive data types, javascript has provided some methods such as toString(), toDateString(), valueOf(), etc. Using these methods javascript objects can be easily converted to primitive data types. Using the toString() method This method returns a string value representing the string format of the given object. The syntax to convert a javascript object into a primitive date type (string, in this example) is ...

Read More

How to convert a JSON string into a JavaScript object?

Lokesh Yadav
Lokesh Yadav
Updated on 09-Dec-2022 3K+ Views

In this article we are going to discuss how to convert a JSON string into a JavaScript object with suitables examples in JavaScript. There are two possible ways to convert a JSON string into a Javascript object – eval() and parse(). The usage of eval() method is unsafe and not preferred. It is vulnerabable to hackers. The parse() method is preferred in general anytime. The typical application for JSON is Data transfer to and from a web server. The data that has been sent from a server is always a JSON string. Using JSON.parse(), we can convert the JSON string ...

Read More

Design a Digital Clock in Neumorphism Style using JavaScript

Imran Alam
Imran Alam
Updated on 08-Dec-2022 492 Views

In this tutorial, we will be discussing how to design a digital clock in neumorphism style using JavaScript. Neumorphism is a new design trend that has been gaining popularity in recent years. It is characterized by soft, rounded shapes and subtle shadows. The HTML We will start by creating a basic HTML structure for our clock. We will need a container element, and within that, we will have an element for the clock face and another for the control buttons. Below is the HTML code for our clock − Start Stop ...

Read More

Stack Data Structure in Javascript

Sai Teja Kotha
Sai Teja Kotha
Updated on 08-Dec-2022 918 Views

In this article, we are going to discuss the stack data structure in JavaScript. A stack is an Abstract Data Type (ADT), commonly used in most programming languages. It is named stack as it behaves like a real-world stack, for example – a deck of cards or a pile of plates, etc. A stack allows operations at one end only. This feature makes it LIFO data structure. LIFO stands for Last-in-first-out. Here, the element which is placed (inserted or added) last, is accessed first. In stack terminology, insertion operation is called PUSH operation and removal operation is called POP ...

Read More

How to send FormData objects with Ajax-requests in jQuery?

Shubham Vora
Shubham Vora
Updated on 08-Dec-2022 15K+ Views

In this tutorial, we will learn How to send FormData objects with Ajax requests in jQuery. The FormData object stores value in the form of key-value pair. It mainly sends form data to the server with HTTP requests. If the form’s encoding type had been set to multipart/form-data, the submitted data would have been sent similarly via the submit() function. The FormData object contains multiple operations methods such as append, delete, set, etc. Syntax const formData = new FormData() formData.append('key', 'value') Users can follow the above syntax to create a FormData object. Asynchronous JavaScript And XML are referred to ...

Read More

How to catch syntax errors in JavaScript?

Sravani Alamanda
Sravani Alamanda
Updated on 08-Dec-2022 2K+ Views

In this tutorial, we will learn how to catch syntax errors in JavaScript. In JavaScript, we get will errors if we write any mistakes in code. Like, ReferenceError, i.e., when we call a variable that does not exist in our code. TypeError i.e. when we tried to change the value which is immutable or try to use a variable in an appropriate way. SyntaxError i.e. when we tried to interpret invalid code. We will learn more about this error in detail below. What is Syntax Error? A syntax error is thrown when there is a glitch in ...

Read More

Find the non-digit character with JavaScript Regular Expression

Sravani Alamanda
Sravani Alamanda
Updated on 08-Dec-2022 2K+ Views

In this tutorial, we will learn to find the non-digit character with JavaScript regular expression. ASCII code 'A' is 65 and 'a' is 97 etc. Now, we will check how to find a nondigit element (\D) in a given text using RegExp. RegExp is an object that specifies the pattern used to do search and replace operations on string or for input validation. RegExp was introduced in ES1 and it is fully supported by all browsers. Syntax Syntax for the non-digit element is, new RegExp("\D") or simply /\D/ /\D/, is introduced in ES1. It is fully supported by ...

Read More
Showing 2371–2380 of 6,517 articles
« Prev 1 236 237 238 239 240 652 Next »
Advertisements