Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Execute Node.js Online

class PeriodicTicks {
  constructor (start, period) {
    this.start=start;
    this.period=period;
  }
  nextOne (time) {
    var number = Math.floor((time-this.start)/this.period);
    return (number+1)*this.period + this.start;
  }
  lastOne (time){
    var number = Math.floor((time-this.start)/this.period);
    return number * this.period;
  }

}
var tick = new PeriodicTicks (0,60*60*6);
console.log (tick.start,tick.period);
console.log (tick.nextOne(42));
console.log (tick.lastOne(42));

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.