JavaScript isNaN() function

The isNan() function returns true if the variable value is not a number otherwise returns false. It internally checks whether the specified value is an illegal number or not. Syntax: isNaN(value) Parameters: value: It represents the value to be checked for not a number. Returns: It returns true if the value is an illegal number … Read more

Create JavaScript Object

By Object() constructor: var obj = new Object(); By Object.create() method: Object.create: Will return a new object with properties of prototypeObject. var obj = Object.create(prototypeObject); By brackets: It is the same as Object.create() method with a null parameter. var obj = {}; By function constructor: var MySite = function(website) { this.website = website; } var … Read more

External JavaScript File

The src attribute of the script tag is used to add or include external JavaScript files into any number of HTML files. It increases the code reusability. Syntax: <script type=”text/javascript” src=”external.js”></script> First, create a JavaScript file and then save the file with the .js extension. After that, we can use the src attribute of the … Read more

Is JavaScript a case-sensitive language?

Yes. JavaScript is a case-sensitive language. Related topics: What is JavaScript? What are the advantages of JavaScript? What are the disadvantages of JavaScript? Is JavaScript a case-sensitive language? How to use external JavaScript file? How to create javascript object? How to add method to javascript object? What does the isNaN() function? What is the difference … Read more

What are the disadvantages of JavaScript?

1. Security: As JavaScript executes on the client side it can be used to exploit the application. 2. UI inconsistency: Sometimes JavaScript is interpreted differently by different browsers resulting in the inconsistent UI. See more at Javascript overview. Related topics: What is JavaScript? What are the advantages of JavaScript? What are the disadvantages of JavaScript? Is JavaScript … Read more

JavaScript advantages and disadvantages

JavaScript advantages Fast speed: JavaScript is executed on the client side that’s why it is very fast. Easy to learn: JavaScript is easy to learn. Anyone who has basic knowledge of programming can easily learn JavaScript. Versatility: It refers to lots of skills. It can be used in a wide range of applications. Browser Compatible: JavaScript supports … Read more

Javascript confirmation dialog box

The Javascript confirmation dialog box is used to display a message to the user to confirm something. Note: Confirmation dialog box gives two buttons “OK” and “Cancel”. The confirm() method returns true if the OK button is clicked else returns false. Example: <!DOCTYPE html> <html> <body> <script> function getConfirmation(){ var retVal = confirm(“Do you want … Read more

Javascript Alert Dialog Box

The Javascript alert dialog box is used to display a warning message to the users. Note: Alert dialog box gives one button “OK”. Example: <!DOCTYPE html> <html> <body> <script> function giveWarning() { alert(“Warning message.”); document.write (“Warning message.”); } </script> <p>Click Submit button and see result.</p> <form> <input type=”button” onclick=”giveWarning()” value=”Submit” /> </form> </body> </html>

Javascript Math Object

A JavaScript Math object provides no. of properties and methods for performing mathematical operations. Math is not a constructor and all the properties and methods of Math are static. Example: <script> var num = Math.random(); var squarRoot = Math.sqrt(num ) ; document.write(“Random Number: ” + num + “</br>”); document.write(“Square root: ” + squarRoot ); </script> … Read more