Articles on Trending Technologies

Technical articles with clear explanations and examples

What is if...else if... statement in JavaScript?

Krantik Chavan
Krantik Chavan
Updated on 13-Jun-2020 456 Views

The if...else if... statement is an advanced form of if…else that allows JavaScript to make a correct decision out of several conditions.SyntaxThe syntax of an if-else-if statement is as follows −if (expression 1){    Statement(s) to be executed if expression 1 is true } else if (expression2){    Statement(s) to be executed if expression 2 is true } else if (expression3){    Statement(s) to be executed if expression 3 is true } else{    Statement(s) to be executed if no expression is true }ExampleYou can try to run the following to learn how to work with if…else if statement in ...

Read More

HTML DOM Parameter Object

AmitDiwan
AmitDiwan
Updated on 13-Jun-2020 176 Views

The HTML DOM Parameter Object represent the element of an HTML document.Create param objectSyntaxFollowing is the syntax −document.createElement(“PARAM”);Properties of param objectPropertyExplanationnameIt returns and modify the value of the name attribute of a param element in an HTML document.valueIt returns and modify the content of the value attribute of a param element in an HTML document.ExampleLet us see an example of param object − Live Demo    html{       height:100%;    }    body{       text-align:center;       color:#fff;       background: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%) center/cover no-repeat;       ...

Read More

HTML DOM Input Date step Property

AmitDiwan
AmitDiwan
Updated on 13-Jun-2020 300 Views

The HTML DOM Input Date step property determines the legal day intervals to choose from when user opens the calendar. It sets or returns the input date step attribute value.SyntaxFollowing is the syntax −Returning number valueinputDateObject.stepSetting value attribute to a number valueinputDateObject.step = numberExampleLet us see an example of Input Date step property − Live Demo Input Date required Odd Days Calendar:    var divDisplay = document.getElementById("divDisplay");    var inputDate = document.getElementById("dateSelect");    divDisplay.textContent = 'Current step: '+inputDate.step; OutputThis will produce the following output. Here, step was set to 2 −

Read More

What are Variable Naming Conventions in JavaScript

Ali
Ali
Updated on 13-Jun-2020 1K+ Views

While naming your variables in JavaScript, keep some rules in mind. The following are the variable naming conventions in JavaScript −You should not use any of the JavaScript reserved keywords as a variable name. These keywords are mentioned in the next section. For example, break or boolean variable names are not valid.JavaScript variable names should not start with a numeral (0-9). They must begin with a letter or an underscore character. For example, 123test is an invalid variable name but _123test is a valid one.JavaScript variable names are case-sensitive. For example, Name and name are two different variables.Here are the Examples  −var name; // correct var 2name; ...

Read More

How to name variables in JavaScript?

Rahul Sharma
Rahul Sharma
Updated on 13-Jun-2020 435 Views

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.While naming your variables in JavaScript, keep the following rules in mind.You should not use any of the JavaScript reserved keywords as a variable name. These keywords are mentioned in the next section. For example, break or boolean variable names are not valid.JavaScript variable names should not start with a numeral (0-9). They must begin with a letter or an underscore character. For example, 123test is an invalid variable name but _123test is a valid one.JavaScript variable names are ...

Read More

What happens when you do not declare a variable in JavaScript?

Ali
Ali
Updated on 13-Jun-2020 283 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          

Read More

Variable Hoisting in JavaScript

Rahul Sharma
Rahul Sharma
Updated on 13-Jun-2020 284 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;

Read More

What is the "double tilde" (~~) operator in JavaScript?

Nitya Raut
Nitya Raut
Updated on 13-Jun-2020 2K+ Views

The “double tilde” (~~) operator is a double NOT Bitwise operator. Use it as a substitute for Math.floor(), since it’s faster.ExampleYou can try to run the following code to learn about double tilde operator −                    var a = 2;          var b,c, d;          b = ~~a;          c = Math.floor(a);          d = ~~b=== c;          document.write(b);          document.write(""+c);          document.write(""+d); // They are equal          

Read More

HTML DOM Input Month step Property

Sharon Christine
Sharon Christine
Updated on 13-Jun-2020 142 Views

The HTML DOM input month step property returns and modify the value of the step attribute of input month field in an HTML document.SyntaxFollowing is the syntax −1. Returning stepobject.step2. Modifying stepobject.step = “number”ExampleLet us see an example of HTML DOM input month step property − Live Demo    html{       height:100%;    }    body{       text-align:center;       color:#fff;       background: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%) center/cover no-repeat;       height:100%;    }    p{       font-weight:700;       font-size:1.1rem;    }    input{   ...

Read More

HTML DOM Input Month max Property

karthikeya Boyini
karthikeya Boyini
Updated on 13-Jun-2020 190 Views

The HTML DOM input month max property returns and modify the value of the max attribute of the input field of type=”month” in a HTML document.SyntaxFollowing is the syntax −1. Returning maxobject.max2. Modifying maxobject.max = “YYYY-MM”Here, YYYY represent year and MM represent month like “2019-02”ExampleLet us see an example of HTML DOM input month max property − Live Demo    html{       height:100%;    }    body{       text-align:center;       color:#fff;       background: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%)       center/cover no-repeat;       height:100%;    }   ...

Read More
Showing 45941–45950 of 61,248 articles
Advertisements