valentincognito
11/20/2018 - 2:23 AM

JavaScript Cheat sheet

A cheat sheet for JavaScript

//get current date
let now = Date.now()

//get timestamp in miliseconds
let timestamp = new Date().getTime()

//get timestamp in seconds
let timestamp = Math.floor(Date.now() / 1000)
//create a new array of random number between 0 and 100
let array = new Array(50).fill().map(() => Math.floor((Math.random() * 100)))