Cross-Browser Solution For addEventListener & attachEvent functions

addEventListener() and attachEvent() these two methods (functions) are used to apply event on Html element. It is considered a secure way to apply JS events. addEventListener() supports 9.0 or higher versions of internet explorer and all modern browsers. To remove the functionality of addEventListener, we use removeEventListener(). addEventListener syntax We don’t write prefix like on … Read more Cross-Browser Solution For addEventListener & attachEvent functions

JavaScript Functions

Basically, A group of statements is known as a function. We can identify function with this syntax function demo(){//function body}. We have to call it to perform any task or run statements in it. We use functions to execute code whenever we want. The other benefit of function is saving memory because functions run whenever … Read more JavaScript Functions

Array’s data sorting

We use the sort() method to sort data from an array. Sorting in ascending order Sorting in descending order Use reverse() method with sort() method Sorting of numbers in ascending order Sorting of numbers in descending order Other Helpful Posts Javascript array Javascript exec commands list Javascript conditions Output methods in Javascript

Intro To JavaScript Array

An array is a variable that can store more than one data (strings or numbers). You use indexing number to access data from a particular index of an array. An array reserves memory blocks in the ram according to its data (indexes numbers) to stores its indexes data serially, but an ordinary variable has only … Read more Intro To JavaScript Array

Javascript execCommand() function

The predefined function execCommand() applies to the text that is selected. You can perform actions like bold, delete, redo, undo, etc. on the selected text in the editable area. You need to use the document prefix before execCommand like this document.execCommand();. exec Commands List bold copy paste cut redo undo delete superscript subscript unlink selectAll … Read more Javascript execCommand() function

Conditions in JavaScript

Condition is a way that helps you to do the programming by applying condition constraints or lets you do programming according to your thinking. You need to know about conditional statements to work on it. There are four conditional statements in Java-script to apply condition which are the following: if condition else condition if else … Read more Conditions in JavaScript

Methods To Get Output in JavaScript

When we want to give any message to the user or print anything on the screen as output in JavaScript then following methods are used for that- window.alert() document.write() console.log() innerHTML window.alert() Output Method Example- document.write() Output Method It replaces all the document to print its result. Example- console.log() Output Method A JavaScript object can … Read more Methods To Get Output in JavaScript