
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

1K+ Views
JavaScript is an untyped language because in JavaScript the variables can hold any data type meaning that JavaScript does not have a type declaration and when the variable is created we do not need to specify any data type unlike other programming languages like Java, C#, C++, etc. which needs int, char, float, etc. to create a variable. In JavaScript we use var, let, and const to create a variable. One of the best parts of untyped language is it gives the flexibility to reassign any type of value to a variable, it doesn't matter whether the initialized value was ... Read More

4K+ Views
JavaScript is a lightweight and interpreted language, therefore, inside the context of a web browser, you don't even need to buy a compiler. You can start with a simple text editor such as Notepad. To make our life simpler, various vendors have come up with very nice JavaScript editing tools. Some of them are listed here − Microsoft FrontPage − Microsoft has developed a popular HTML editor called FrontPage. FrontPage also provides web developers with a number of JavaScript tools to assist in the creation of interactive websites. Macromedia Dreamweaver MX − Macromedia Dreamweaver MX is a very popular ... Read More

229 Views
Yes, this can be done. When you have a global scope, you can use a variable without declaring it. The following “no var” variable “points” will look at the scope chain, wince var keyword isn’t use − var rank = 5; points = 50; marks = 300; // Anonymous function (function() { points = 100; //overwrites global scope points var rank = 4; //new rank variable is created in this' function's scope var marks = 900; document.write(rank+"\r"); //prints 4 document.write(points+"\r"); //prints 100 document.write(marks+"\r"); //prints 900 })(); document.write(''); document.write(''); document.write(rank+"\r"); //prints 5 document.write(points+"\r"); //prints 100 document.write(marks+"\r"); //prints 300

246 Views
When you can use a JavaScript variable before it is declared, it is done using a technique called hoisting. The parser read through the complete function before running it.The behavior in which a variable appears to be used before it is declared is known as hoisting −For example, the following,points =200; var points;The above works the same like the following −var points; ponts = 200;

3K+ Views
In this article, we will learn to achieve the same result as $(document).ready in JavaScript. In jQuery, $(document).ready() is a widely used function that ensures the DOM (Document Object Model) is fully loaded before executing JavaScript code. Different approaches The following are the approaches to achieve the same result as $(document).ready in JavaScript − Using document.readyState Using DOMContentLoaded Event Using document.readyState In jQuery, if you want an event to work on your page, you should call it inside the $(document).ready() function. Everything inside it will load as soon as the ... Read More

13K+ Views
In this tutorial, we will learn to validate decimal numbers in JavaScript. A number containing decimal(.) is known as a decimal number. A number comes between the two whole numbers, called decimal numbers. We use decimal numbers in calculations, progress bars, to accept input in forms, etc. A regular expression is a well-known entity for validation purposes. A Regular expression is a search pattern of characters with a specific meaning used to validate the data. It can be used for any string or number. We are going to use it for validation purposes in JavaScript. We used a simple logic ... Read More

3K+ Views
A data type is known as a composite data type when it represents a number of similar or different data under a single declaration of variable i.e., a data type that has multiple values grouped together. There are mainly three types of composite data types named as below −ObjectArrayFunctionIn this article, we will discuss the first type of composite data type i.e. object.ObjectAn object is a collection of properties i.e, an object can store the properties of anything in the key-value pairs. An object in javascript has keys and each key has its own value as shown in the examplelet ... Read More

501 Views
The following is stated about declaration and initialization of a variable in ECMAScript specification −A var statement declares variables that are scoped to the running execution context’s VariableEnvironment. Var variables are created when their containing Lexical Environment is instantiated and are initialized to undefined when created. [...] A variable defined by a VariableDeclaration with an Initializer is assigned the value of its Initializer’s AssignmentExpression when the VariableDeclaration is executed, not when the variable is created.The above defines the difference:All variables are initialized with the value undefined.Variables declarations are initialized with undefined upon the initialization of their lexical environment.This initialization does ... Read More