How to parse float with two decimal places in JavaScript ?
JavaScript is a client-side scripting language that’s high-level, dynamically typed, and interpreted. It comes with a built-in method called parseFloat() which is used to convert a string into a floating-point number....
read more
How to access variables from another file using JavaScript ?
In JavaScript, variables can be accessed from another file using the <script> tags or the import or export statement. The script tag is mainly used when we want to access a variable of a JavaScript file in an HTML file. This works well for client-side scripting as well as for server-side scripting. The import or export statement however cannot be used for client-side scripting. The import or export statement works in Node.js during server-side scripting....
read more
Extract a number from a string using JavaScript
In this article, we will learn how we can extract the numbers if exist in a given string. we will have a string and we need to print the numbers that are present in the given string in the console....
read more
How to Create a Form Dynamically with the JavaScript?
The task is to create an HTML form dynamically with the help of JavaScript. There are two approaches that are discussed below.Approach 1: Use document.createElement() to create the new elements and use setAttribute() method to set the attributes of elements. Append these elements to the <form> element by appendChild() method. Finally append the <form> element to the <body> element of the document. This example creates a Registration form....
read more
How to get current formatted date dd/mm/yyyy in JavaScript ?
In this article, we will see how to get the format current date in dd/mm/yyyy format by using JavaScript. We’re going to discuss a few methods. The first few methods to know....
read more
Difference between Java and JavaScript
Java is a statically typed, object-oriented programming language for building platform-independent applications. JavaScript is a dynamically typed scripting language primarily used for interactive web development. Despite similar names, they serve different purposes and have distinct syntax, runtime environments, and use cases....
read more
How to get the ID of the clicked button using JavaScript/jQuery ?
Sometimes a developer has to know the ID of the button that the user has clicked to decide further course of action on a webpage....
read more
JavaScript adding a class name to the element
The class name attribute can be used by CSS and JavaScript to perform certain tasks for elements with the specified class name. Adding the class name by using JavaScript can be done in many ways....
read more
How to convert a number into array in JavaScript ?
In this article, we have been given a number and the task is to convert the given number into an array using JavaScript....
read more
How to disable scrolling temporarily using JavaScript ?
We know as long as the height of the web page gets increased it shows the scroll and we are going to discuss how can we disable that scrolling behavior temporarily using JavaScript....
read more
How to Check a Key Exists in JavaScript Object ?
Checking if a key exists in a JavaScript object involves verifying whether a specific property is defined within the object. This practice ensures data integrity, prevents errors, and facilitates smooth program execution by confirming property existence before accessing or manipulating it....
read more
Reverse a String in JavaScript
We have given an input string and the task is to reverse the input string in JavaScript. It is a very common question asked in a JavaScript interview. There are various methods to reverse a string in JavaScript, which are described below with examples....
read more