
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

6K+ Views
In this article, we will learn what characters are valid for JavaScript variable names. We use variables to save values. First, we have to define the variable, and then we can assign a value to it. We can use the variable name to access the variable in the code. With a variable name, we can reassign its value. As you adhere to a few principles, variable names are quite versatile. Rules A letter, dollar sign($), or underscore (_) must make up the first character. A number cannot be the initial character. Any letter, number, or underscore can complete the ... Read More

17K+ Views
In this tutorial, we will learn to check for null, undefined, or blank variables in JavaScript. There is no particular built-in library function to check whether a variable is undefined or null. Still, we can use some operators such as typeof operator and equality operator to check the variable. Before we proceed with the tutorial, let’s clear the doubt between the null, undefined, or blank variable. Null VS Undefined We can say that the Null and undefined variables are almost the same but not identical. Undefined variable − It is a variable not declared in the program, and the ... Read More

212 Views
To check if a variable is an array, use “instanceof. The following is the syntax −variable instanceof ArrayExampleLet’s seen an example to check if the variable “sports” is an array or not? var sports = [ "tennis", "football", "cricket" ]; if (sports instanceof Array) { alert('Array!'); } else { alert('Not an array'); }

324 Views
The delete operator in JavaScript is used to remove properties from an object to remove element(s) from an array or to remove element(s) from a set object. Always remember the following points about delete: delete is a keyword in JavaScript, so it shouldn’t be altered, and you cannot use delete objects in single variables since it is used only for deleting properties of objects. Let's look in detail at how we can implement delete operators in JavaScript. Deleting object properties Objects in JavaScript, we will write using key-value pair like const Employee = { firstname: 'Devika', ... Read More

16K+ Views
To create dynamic variable names inside a JavaScript loop, means it is not hardcoded already, and we can create it according to our needs from some other string values. For achieving this, we will be understanding four different approaches. In this article our task is to create dynamic variable names inside a JavaScript loop. Approaches to Create Dynamic Variable Names Here is a list of approaches to create dynamic variable names inside a JavaScript loop which we will be discussing in this article with stepwise explanation and complete example codes. Using Array ... Read More

99 Views
JavaScript variables are not typed but their values do have a type. The same variable can be assigned new values.ExampleLive Demo var a; document.write(typeof a+"\r"); a = true; document.write(typeof a+"\r"); a = 5; document.write(typeof a+"\r"); a = "web"; document.write(typeof a+"\r");

2K+ Views
When learning different programming languages, you may come across terms like untyped and dynamically typed. While they may sound similar but they have different concepts in how programming languages manage data types. In this article, we will see these concepts in simple terms with simple examples. Untyped Language Untyped programming languages do not have a strict definition of data types. This allows you to use values without providing the data type. The interpreter or execution environment will handle everything anyway it considers a match. Example Let us look at an example that uses an untyped language - # ... Read More

143 Views
In JavaScript, variables are defined using the var keyword followed by the variable name. Before you use a variable in a JavaScript program, you must declare it. Variables are declared with the var keyword as follows.var rank;A data type isn’t needed in JavaScript. Variables in JavaScript are not handled like other strong typed language C++, Java, etc.Storing a value in a variable is called variable initialization. You can do variable initialization at the time of variable creation or at a later point in time when you need that variable. var name = "Amit"; var rank = 2;

392 Views
JavaScript handling of the variable is different from other programming languages C, C++., Java, etc. Variables in JavaScript can be thought of as named containers. You can place data into these containers and then refer to the data simply by naming the container. Before you use a variable in a JavaScript program, you must declare it. Variables are declared with the var keyword as follows. var rank; var points; Storing a value in a variable is called variable initialization. You can do variable initialization at the time of variable creation or at a ... Read More

5K+ Views
In this tutorial, we will learn what “javascript: void(0)” means. In English, void means nothing. In a programming language, void means return nothing. “javascript: void(0)” is similar to void. javascript: void(0) means return undefined as a primitive value. We use this to prevent any negative effects on a webpage when we insert some expression. For example, in the case of URL hyperlinks. Hyperlinks open by reloading the page when the user clicks on the link. When you need to run some other code in such cases, you can use javascript: void(0). Let’s split javascript: void(0) with a colon. We get ... Read More