Ad
  • Default User Avatar

    I think, for our specific function, where we are dealing with seconds and presumably expect non-negative numeric inputs, either parseInt or Math.floor should work fine.
    In other cases it could be different:
    console.log(Math.floor(-3.5)); // Output: -4
    console.log(parseInt("-3.5")); // Output: -3