- 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 10877 Articles for Web Development
86 Views
The web browser throws an error for “var null” because it is a reserved identifier.You cannot use the following literals as identifiers in ECMAScript −null frue falseundefined A property with no definition. It is not known and not a reserved identifier. Its type is undefined.nullIt is known and a reserved identifier. But “null” isn’t the same as “false”. When you will declare a variable and set it to null, then null will get printed.
352 Views
Reserved words cannot be used as JavaScript variables, functions, methods, loop labels, or any object names.Here are the reserved words in JavaScript −abstractElseinstanceofswitchbooleanEnumintsynchronizedbreakExportinterfacethisbyteExtendslongthrowcaseFalsenativethrowscatchFinalnewtransientcharFinallynulltrueclassFloatpackagetryconstForprivatetypeofcontinueFunctionprotectedvardebuggerGotopublicvoiddefaultIfreturnvolatiledeleteimplementsshortwhileDoImportstaticwithdoubleInsuper
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
225 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
11K+ Views
This tutorial will teach us how to replace all occurrences of a string in JavaScript which mean by the end of the tutorial we will learn to detect a given type of substring from the given string and replace it will another given string by the user. To replace all occurrences of a string in JavaScript we have three methods which we are going to see in this tutorial, they are: splitting the string into an array and then joining it back by adding replacement in gaps, with the global regular expression using the replace() method, and at last we ... Read More
732 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
3K+ 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
142 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
161 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;
2K+ Views
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 DOM is loaded and before the page contents are loaded.$(document).ready(function() { alert(“Document loaded successful!"); });ExampleIn JavaScript, to achieve the same result like $(document).ready, try the following code − var loader = setInterval(function () { if(document.readyState !== "complete") return; clearInterval(loader); alert(“Document loaded successful!"); // document.write("Document loaded successful!"); }, 300);
To Continue Learning Please Login
Login with Google