Implement a Clock in JavaScript How idiomatic is my code? 

var Clock = function(hour, minute) {
  this.hour = hour || 0;
  this.minute = minute || 0;

  this.plus = function(minutes) {
    computed_minutes = this.minute + minutes
    if (computed_minutes &gt; 60) {
      this.minute = computed_minutes % 60
      this.hour += computed_minutes / 60
    } else {
      this.minute = computed_minutes
    }
    if (this.hour &gt;= 24) {
      this.hour = this.hour - 24
    }
    this.hour = Math.round(this.hour)
    this.minute = Math.round(this.minute)
    return this;
  },

  this.minus = function(minutes) {
    computed_minutes = this.minute - minutes
    if (computed_minutes &lt; 0) {
      this.minute = 60 + computed_minutes % 60
      this.hour -= (1 + Math.abs(computed_minutes / 60))
    } else {
      this.minute = computed_minutes;
    }
    if (this.hour &lt; 0) {
      this.hour = 24 + this.hour
    }

    this.hour = Math.round(this.hour)
    this.minute = Math.round(this.minute)

    return this;
  },

  this.equals = function(other) {
    return this.hour == other.hour &amp;&amp; this.minute == other.minute;
  }

}

Clock.at = function(hour, minute) {
  c = new Clock(hour, minute);
  return c;
}

Clock.prototype.toString = function() {
  function format(n) {
    return n &gt;= 10 ? n : "0" + n;
  }
  return format(this.hour) + ":" + format(this.minute)
}

module.exports = Clock;
Some issues:


Every instance of Clock gets its own instance of plus and minus rather than attaching these functions to the prototype.
Clock.at sets a global variable c.
Clock.prototype.toString creates the format function each time it is called; you can move this out of the function and into a different scope so it is only created once.
plus and minus do a lot of checking that could be moved into a single set function and then this can also be called from the constructor (so that the same checks and rounding is also done in the constructor).
24 and 60 appear as magic constants. In this context it is easy to understand what they are but it would be better to assign them to named constants (HOURS_PER_DAY and MINUTES_PER_HOUR) that identify why those magic numbers are being used.


My suggestions:

module.export = (function(){
    var Clock = function( hours, minutes ) {
      this.set( hours, minutes )
    }

    Clock.at = function(hours, minutes) {
      return new Clock(hours, minutes);
    }

    Clock.HOURS_PER_DAY = 24;
    Clock.MINUTES_PER_HOUR = 60;

    Clock.prototype.set = function( hours, minutes ){
        var hrs = Math.round( hours || 0 ); 
        var mns = Math.round( minutes || 0 );

        this.hour = ( hrs + Math.floor( mns / Clock.MINUTES_PER_HOUR ) ) % Clock.HOURS_PER_DAY;
        if ( this.hour &lt; 0 )
        {
            this.hour += Clock.HOURS_PER_DAY;
        }

        this.minute = mns % Clock.MINUTES_PER_HOUR;
        if ( this.minute &lt; 0 )
        {
            this.minute += Clock.MINUTES_PER_HOUR;
        }

        return this;
    }

    Clock.prototype.plus = function(minutes) {
     return this.set( this.hour, this.minute + minutes )
    },

    Clock.prototype.minus = function(minutes) {
     return this.set( this.hour, this.minute - minutes );
    },

    Clock.prototype.equals = function(other) {
     return this.hour == other.hour &amp;&amp; this.minute == other.minute;
    }

    function format(n) {
        return n &gt;= 10 ? n : "0" + n;
    }

    Clock.prototype.toString = function() {
          return format(this.hour) + ":" + format(this.minute)
    }

    return Clock;
})();