Singsys blog: Javascript

How to get a Timestamp in JavaScript

 Timestamp JavaScript

Method getTime() returns the total number of milliseconds between midnight of January 1, 1970 and the date specified by you. The often requirement to calculate with unix timestamp.

(more…)

How to Append Anything into JavaScript Array

Append in Javascript Array with Push()

The push() method is used for adding one or more elements at the end of an array and returns the new length of the array. In order to add items at beginning of the array unshift() method is used. It  can be used with call() or apply() with objects that are similar to arrays. The push method applies the  length property to identify pint of inserting the given values. When the length property is not  converted into a number 0 is used as index. This considers the possibility of length being nonexistent hence in such scenario length will be created.

(more…)