Category: JavaScript

javascript documentation

JavaScript Sorting Arrays

The sort() method sorts an array alphabetically: Reversing an Array The reverse() method reverses the elements in an array. You can use it to sort an array in descending order: Numeric Sort By default, the sort() function sorts values as strings. This works well for strings (“Apple” comes before “Banana”). However, if numbers are sorted as strings, “25” is bigger than “100”, […]

JavaScript Arrays

JavaScript arrays are used to store multiple values in a single variable. There are 3 ways to construct array in JavaScript By array literal By creating instance of Array directly (using new keyword) By using an Array constructor (using new keyword) 1) JavaScript array literal The syntax of creating array using array literal is given […]

JavaScript Strings

The JavaScript string is an object that represents a sequence of characters. There are 2 ways to create string in JavaScript By string literal By string object (using new keyword) A JavaScript string is zero or more characters written inside quotes You can use quotes inside a string, as long as they don’t match the quotes surrounding […]

HTML DOM Events

HTML DOM events allow JavaScript to register different event handlers on elements in an HTML document. Events are normally used in combination with functions, and the function will not be executed before the event occurs (such as when a user clicks a button). HTML DOM Event Properties and Methods Property/Method Description Belongs To altKey Returns […]

JavaScript Events

HTML events are “things” that happen to HTML elements. When JavaScript is used in HTML pages, JavaScript can “react” on these events. HTML Events An HTML event can be something the browser does, or something a user does. Here are some examples of HTML events: An HTML web page has finished loading An HTML input field was changed An […]

JavaScript Objects

A javaScript object is an entity having state and behavior (properties and method). For example: car, pen, bike, chair, glass, keyboard, monitor etc. JavaScript is an object-based language. Everything is an object in JavaScript. JavaScript is template based not class based. Here, we don’t create class to get the object. But, we direct create objects. […]

JavaScript Functions

JavaScript functions are used to perform operations. We can call JavaScript function many times to reuse the code. Advantage of JavaScript function There are mainly two advantages of JavaScript functions. Code reusability: We can call a function several times so it save coding. Less coding: It makes our program compact. We don’t need to write many […]

JavaScript Data Types

JavaScript provides different data types to hold different types of values. There are two types of data types in JavaScript. Primitive data type Non-primitive (reference) data type JavaScript is a dynamic type language, means you don’t need to specify type of the variable because it is dynamically used by JavaScript engine. You need to use var here to specify the […]

JavaScript Operators

JavaScript operators are symbols that are used to perform operations on operands. For example: Here, + is the arithmetic operator and = is the assignment operator. There are following types of operators in JavaScript. Arithmetic Operators Comparison (Relational) Operators Bitwise Operators Logical Operators Assignment Operators Special Operators JavaScript Comparison Operators JavaScript Logical Operators Operator Description […]

JavaScript Variable

A JavaScript variable is simply a name of storage location. There are two types of variables in JavaScript : local variable and global variable. There are some rules while declaring a JavaScript variable (also known as identifiers). JavaScript variables are containers for storing data values. In this example, x, y, and z, are variables: From the example above, you can […]

error

Enjoy this blog? Please spread the word :)

RSS20
Follow by Email
Facebook20
Pinterest9