- 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 8895 Articles for Front End Technology
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
12K+ 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
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
2K+ 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
![Johar Ali](https://www.tutorialspoint.com/assets/profiles/14293/profile/60_101691-1513053093.jpg)
416 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
![Ali](https://www.tutorialspoint.com/assets/profiles/14292/profile/60_101553-1513052445.jpg)
86 Views
Before you use a variable in a JavaScript program, you must declare it. Variables 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.Variables are declared with the var keyword as follows. You can also declare multiple variables with the same var keyword as follows − This is also you can assign values −var rank = 2; var points = 100;
![Sravani Alamanda](https://www.tutorialspoint.com/assets/profiles/507714/profile/60_44900-1661507911.jpg)
3K+ Views
Yes, you can use a JavaScript variable before it is declared, with a technique called hoisting. The parser reads through the complete function before running it. The behavior in which a variable appears to be used before it's declared is known as hoisting. For example, the following, rank = 5; var rank; The above works the same as the following − var rank; rank = 2; Hoisting in JavaScript, allows us to declare variables, functions, or classes that are moved to the top of the scope preceding the execution of the code regardless of whether their scope ... Read More
![Johar Ali](https://www.tutorialspoint.com/assets/profiles/14293/profile/60_101691-1513053093.jpg)
209 Views
The Boolean object represents two values, either "true" or "false". If value parameter is omitted or is 0, -0, null, false, NaN, undefined, or the empty string (""), the object has an initial value of false.The new Boolean() is used to create a new object. Use the following syntax to create a boolean object.var val = new Boolean(value);ExampleLet us see an example of toString() method, which returns a string of either "true" or "false" depending upon the value of the object − JavaScript toString() Method var flag = new Boolean(false); document.write( "flag.toString = " + flag.toString() );
![Amit Sharma](https://www.tutorialspoint.com/assets/profiles/14294/profile/60_103411-1513053466.png)
514 Views
A boolean variable in JavaScript has two values True or False.ExampleYou can try to run the following code to learn how to work with Boolean variables − 35 > 20 Click for result function myValue() { document.getElementById("test").innerHTML = Boolean(35 > 20); }
![Ali](https://www.tutorialspoint.com/assets/profiles/14292/profile/60_101553-1513052445.jpg)
27K+ Views
JavaScript is an untyped language. This means that a JavaScript variable can hold a value of any data type. To declare variables in JavaScript, you need to use the var, let, or const keyword. Whether it is a string or a number, use the var, let, or const keyword for its declaration. But for declaring a string variable we had to put the string inside double quotes or single quotes.Here’s how you can declare strings in JavaScript -var name = "David"; var subject = "Programming";ExampleYou can try to run the following code to learn how to declare strings in JavaScript ... Read More