Saturday, October 25, 2025
HomeLanguagesJavascriptLodash _.now() Method

Lodash _.now() Method

The _.now() method is used to get the timestamp of the number of milliseconds that have elapsed since the Unix epoch (1 January 1970 00:00:00 UTC).

Syntax:

_.now()

Parameters: This method does not accept any parameter.

Return Value: This method returns the timestamp.

Example 1:

Javascript




// Defining Lodash variable
const _ = require('lodash');
  
// Getting the timestamp
console.log(_.now());


Output:

1599545119753

Example 2:

Javascript




// Defining Lodash variable
const _ = require('lodash');
  
// Creating print function to print
// timestamp after delay of 10ms 
function print(){ 
    setTimeout(() => { 
        console.log(
`Current timestamp is: ${_.now()}`) 
    }, 10) 
  
// Running this function 5 times
// using _.times() function. 
_.times(5, print) 
console.log("Type of timestamp is: "
    typeof(_.now())) 


Output:

Type of timestamp is:  number
Current timestamp is: 1599546710915
Current timestamp is: 1599546710916
Current timestamp is: 1599546710916
Current timestamp is: 1599546710916
Current timestamp is: 1599546710916

Note: This will not work in normal JavaScript because it requires the lodash library to be installed.

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32361 POSTS0 COMMENTS
Milvus
88 POSTS0 COMMENTS
Nango Kala
6728 POSTS0 COMMENTS
Nicole Veronica
11892 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11954 POSTS0 COMMENTS
Shaida Kate Naidoo
6852 POSTS0 COMMENTS
Ted Musemwa
7113 POSTS0 COMMENTS
Thapelo Manthata
6805 POSTS0 COMMENTS
Umr Jansen
6801 POSTS0 COMMENTS