
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 6710 Articles for Javascript

472 Views
To obtain dates in JavaScript, use either the new Date() or Date() function Object() { [native code] } (either current date or a specific date). While the Date() function Object()produces a string containing the current date and time, the new Date() function Object()creates a new Date object. Let’s dive into the article for getting better understanding on how to format date value in JavaScript How to Format Dates in JavaScript? Date formatting is dependent on you and your requirements. In some nations, the year (06/22/2022) comes first, then the month. In other cases, the day precedes the month, the year ... Read More

2K+ Views
The task we are going to perform in this article is it possible to create a new data type in JavaScript. For instance, let’s consider we have variable student − var student = "username" console.log(typeof student) Now, I want to declare the type of that variable and print that in the output, and it will look like this − Output:"string" Let’s dive into the article to learn more about creating a new data type in JavaScript. Yes, it is possible to create a new data type in JavaScript, you can use the concept of Class. If you want ... Read More

688 Views
The innerHTML property of an element in JavaScript allows you to access or modify any HTML or XML markup that is there. Use the method insertAdjacentHTML () to insert HTML into the page as opposed to changing an element's content. In JavaScript to change a tag’s innerHTML based on their order can be done using document.querySelectorAll(). Let’s jump into the article to learn more about changing the tag’s innerHTML based on their order. Using document.querySelectorAll() The static NodeList returned by the Document function querySelectorAll() lists all of the document's elements that match the given set of selectors. Syntax Following is ... Read More

2K+ Views
Let’s say the following is our button −Press MeOn filling the below input field, the color of the above button should change −ExampleFollowing is the code − Live Demo Document UserName: Press Me function changeTheColorOfButtonDemo() { if (document.getElementById("changeColorDemo").value !== "") { document.getElementById("buttonDemo").style.background = "green"; } else { document.getElementById("buttonDemo").style.background = "skyblue"; } } To run ... Read More

778 Views
These days, password generators can be found all over the internet. Without a strong enough password, websites frequently won't let you establish an account. The task we are going to perform was how to create a password generator JavaScript. Let’s dive into the article for getting better understanding on creating a password generator. For this, use Math.random() to create random passwords. Using Math.random() method A floating-point pseudo-random number in the range [0, 1], 0 (inclusive), and 1(exclusive) is returned by the JavaScript function Math.random(). You can then resize this random number to fit the necessary range. Syntax Following is the ... Read More

687 Views
In JavaScript Arrays are used to store multiple values in a single variable. This is compared to a variable that can store only one value. Each item in an array has a number attached to it, called a numeric index, that allows you to access it. In JavaScript, arrays start at index zero and can be manipulated with various methods. This basically tells about true or false. If the item is found then it returns true, else false is returned. You can achieve the same in JavaScript arrays, using includes. Let’s dive into the article to understand more about the ... Read More

13K+ Views
In JavaScript, there are built-in methods for getting the current date and time in seconds. We are going to perform this in two ways − Using the Date.now() method Using a new date getTime() method Let’s dive into the article for getting better understanding on getting current date time in seconds. Using Date.now() method The Date.now() static method returns the milliseconds that ... Read More

132 Views
If the const is used in a program, and if you try to reassign the value to const variable then an error will arise.Let’s say the following is our const variable −const result = (first, second) => first * second;Now, we will try to reassign a value to the const variable and an erro can be seen in the output.ExampleFollowing is the code −const result = (first, second) => first * second; result = first => first =first*10; console.log(result(10, 20)); To run the above program, you need to use the following command −node fileName.js.Here, my file name is demo284.js.OutputThis will produce ... Read More

3K+ Views
The task at hand is to learn how to remove all blank objects from a JavaScript object. Let’s consider the following object − const details = { name: 'John', age: {}, marks: { marks: {} } } We need to remove the black objects above You can use forEach() along with typeof and delete to remove blank objects. Let’s dive into the article for getting better understanding on removing blank objects. Using reduce() A reducer function is run for each element of an array using the reduce() method. The function's ... Read More

1K+ Views
An array in JavaScript is a group of identically typed elements that are stored in adjacent memory locations and may each be separately referred to using an index to a special identifier. Let’s consider an array consisting of occurrences of repeated names. The array looks like this − var details = [ { studentName: "John", studentAge: 23 }, { studentName: "David", studentAge: 24 }, ... Read More