firstChild & lastChild Properties in JavaScript

These firstChild and lastChild both are HTML element properties in Javascript. In Html documentation, the first child element must be written just after its parent element without breaking the line (or without pressing the ‘enter’). Otherwise, you will see an empty result as the first child element’s value. We use firstChild property when we want … Read more

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

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

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