- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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 6683 Articles for Javascript
2K+ Views
An ordered group of indexed elements is represented by an array, which is a type of data structure. Merging two or more arrays to create a larger array that contains all the items from the original arrays is a typical operation done on multiple arrays. In JavaScript, there are several ways to add two arrays together and create a new array. This article, will go over how to properly use the concat() method, spread operator (...), to combine two separate arrays into one newly created array. Additionally, each of these methods will be discussed with examples so that you ... Read More
1K+ Views
The TODO list is a list that typically used to keep track of all the things we need to do in a given day, with the most crucial chores at the top and the least important items at the bottom. We can use it to plan our everyday schedules. We have the flexibility to add new assignments to the list, as well as remove those tasks that have been completed. A TODO list can be used to complete the following four main tasks Add new task Delete task Mark task as completed Edit task Let’s look into the ... Read More
443 Views
In JavaScript, there is a array method that allows you to easily extract data from an array and assign it to new independent variables. This can be useful when working with large datasets or when needing to access specific values within an array quickly. In this article, we will explore how to use the dot(.) notation, for pulling data from an array into new independent variables in JavaScript. Let us know, what is an Independent variable! An independent variable is a variable that stands alone and isn't influenced by any other variables. It can be manipulated or changed, and it ... Read More
165 Views
Yes, the not not operator is the reverse process of not operator. If any value is true then single ! (not) will return false and !! will return opposite value (true).The not operator −var flag=true; console.log(!flag);The not not operator −var flag=true; console.log(!!flag);ExampleFollowing is the code −var flag=true; console.log("The result of single !=") console.log(!flag); console.log("The result of single !!=") console.log(!!flag)To run the above program, you need to use the following command −node fileName.js. Here, my file name is demo247.jsOutputThis will produce the following output on console −PS C:\Users\Amit\javascript-code> node demo247.js The result of single != false The result of single !!= ... Read More
804 Views
The task we are going to perform in this article is setting a default variable value to undefined in a function. Before we jump into the article, let’s understand what are functions in JavaScript. One of the core components of JavaScript are functions. In JavaScript, a function is comparable to a procedure-a collection of statements that carry out an action or compute a value. However, in order for a process to be considered a function, it must accept an input and produce an output with an evident connection between the input and the result. Let’s see how to set a ... Read More
3K+ Views
Testing if a parameter is provided to a function in JavaScript is an important part of writing effective code. It allows you to ensure that the arguments passed into your functions are valid and properly formatted for use within the function. In this article, we will discuss different methods for testing whether or not a parameter has been provided to a function in JavaScript. Let us understand, the term “Parameter”. A parameter is a named entity in a function definition that specifies an argument which the function can accept. It acts as a variable within the function and its value ... Read More
633 Views
The task we are going to perform in this article is clear element classlist in JavaScript. Before we jump into the article let’s have a quick view on the few things. All element objects (i.e., objects that represent elements) in a Document derive from the most general base class is called Element. It only contains functions and characteristics that apply to all types of elements. Classlist in JavaScript JavaScript classList is a DOM attribute that enables customizing of an element's CSS (Cascading Style Sheet) classes. The read-only JavaScript classList property retrieves the names of the CSS classes. Syntax Following ... Read More
3K+ Views
In this article we are going to learn about how to insert space after every two letters in string. Before we jump into the article let’s have a quick view on the strings in JavaScript. A sequence of one or more characters—which could be numbers, or symbols—is referred to as a string. Strings are immutable primitive data types in JavaScript, which means they cannot be changed. Let’s dive into the article to learn more about inserting a space after every two letters in strings. For this, use replace() along with regular expressions. The replace() methodinJavaScript The replace() method ... Read More
1K+ Views
Multiple values can be kept in a single variable by using arrays. Compare that to a variable that only has room for one value. Each item in an array has a number associated with it that you may access by using, referred to as a numeric index. Arrays in JavaScript begin at index zero and can be changed using a variety of operations. The addEventListener()Method The addEventListener() is a method in JavaScript that allows an element to be assigned an event handler, which will execute when a specified event occurs. This can include things like mouse clicks, form submission, ... Read More
211 Views
The colon (:) can be used when you want to define the property to an object while equal (=) can be used when you want to assign a value to a variable.ExampleFollowing is the code −var studentDetails = { "studentId": 101, "studentName": "John", "studentSubjectName": "Javascript", "studentCountryName": "US" } console.log(studentDetails); var firstName = "David"; console.log(firstName);To run the above program, you need to use the below command −node fileName.js.Here, my file name is demo325.js.OutputThis will produce the following output −PS C:\Users\Amit\javascript-code> node demo325.js { studentId: 101, studentName: 'John', studentSubjectName: 'Javascript', studentCountryName: 'US' } David