×
Home
Jobs
Tools
Coding Ground
Current Affairs
UPSC Notes
Online Tutors
Whiteboard
Net Meeting
Tutorix
Login
Packages
Categories
Java
JSP
iOS
HTML
Android
Python
C Programming
C++ Programming
C#
PHP
CSS
Javascript
jQuery
SAP
SAP HANA
Data Structure
RDBMS
MySQL
Mathematics
8085 Microprocessor
Operating System
Digital Electronics
Analysis of Algorithms
Mobile Development
Front End
Web Development
Selenium
MongoDB
Computer Network
General Topics
Library
Videos
Q/A
eBooks
Login
Library
Videos
eBooks
Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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
Johar Ali
has Published
71
Answers
How to check if a variable is NaN in JavaScript?
Javascript
Web Development
Front End Technology
Johar Ali
Published on 16-Jan-2018 11:29:20
NaN is a JavaScript property, which is "Not-a-Number" value. To find out whether value is NaN, use the Number.isNaN() or isNan() method.ExampleHere’s an example to check if a variable in NaN in JavaScriptLive Demo<!DOCTYPE html> <html> <body> <button onclick="display()">Check</button> <p id="test"></p> ...
Read More
Why JavaScript 'var null' throw an error but 'var undefined' doesn't?
Javascript
Web Development
Front End Technology
Johar Ali
Published on 16-Jan-2018 11:18:55
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. ...
Read More
How to replace all occurrences of a string in JavaScript?
Javascript
Web Development
Front End Technology
Johar Ali
Published on 16-Jan-2018 10:32:36
To replace occurrences of a string in JavaScript, use the replace() method −<html> <body> <script> var str1 = 'John loves studying. He loves Football too!'; var str2 = str1.replace(/loves/g, "likes"); document.write(str2); ...
Read More
What is $(document).ready() equivalent in JavaScript?
Javascript
Web Development
Front End Technology
Johar Ali
Published on 14-Jan-2018 11:59:38
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 ...
Read More
What is the difference between Declaring and Initializing a variable in JavaScript?
Javascript
Web Development
Front End Technology
Johar Ali
Published on 12-Jan-2018 17:05:14
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 ...
Read More
What is the purpose of new Boolean() in JavaScript?
Javascript
Web Development
Front End Technology
Johar Ali
Published on 12-Jan-2018 14:54:51
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 ...
Read More
What are the differences between JavaScript Primitive Data Types and Objects?
Javascript
Web Development
Front End Technology
Johar Ali
Published on 12-Jan-2018 10:55:31
Before beginning with the difference, let’s learn what are Primitive Datatypes. Primitive defines immutable values and introduced recently by ECMAScript standard.JavaScript allows you to work with three primitive data types, Numbers, eg. 3, 310.20 etc.Strings of text e.g. "This text string" etc.Boolean e.g. true or false.JavaScript also defines two trivial ...
Read More
How to minimize the use of global variables in JavaScript?
Javascript
Web Development
Front End Technology
Johar Ali
Published on 11-Jan-2018 17:13:52
A global variable has global scope which means it can be defined anywhere in your JavaScript code. To minimize the usage of global variables, use consistent variables around different parts of your project.var myValue = { common: function(){ //Add code }, val1: { ...
Read More
What are the differences between inline JavaScript and External file?
Javascript
Web Development
Front End Technology
Johar Ali
Published on 11-Jan-2018 14:06:14
The following are the difference between inline JavaScript and external file −External scriptsThe browser stores the external script once it is downloaded for the first time. If it is to be referenced again, then no additional download is needed.This reduces download time and size.The async and defer attributes have an ...
Read More
How does the browser identify inline JavaScripts?
Javascript
Web Development
Front End Technology
Johar Ali
Published on 11-Jan-2018 12:38:05
Let’s say the following line we have in our HTML −<input type="Button" value="Result" onclick="alert(‘Hello World!’);"/>Here the browser identifies inline JavaScript by detecting onclick, even when <script> tag wasn’t available.The following are some of the suggestions for using inline JavaScripts −You should consider inline script elements such as <script>...</script>) if the ...
Read More
Previous
1
2
3
4
5
6
7
8
Next
Advertisements
Print
Add Notes
Bookmark this page
Report Error
Suggestions
Save
Close
Dashboard
Logout