What types of javascript functions should I use, and what functions should I stay away from -


i've been reading , different types of functions can use in javascript. many developers seem agree object literal functions:

var hotel = {   name: "quay",   rooms: 40,   booked: 25,   checkavailability: function() {     return this.rooms - this.booked;   }  }; 

and

function getarea(width, height) {      return width * height; } 

are best functions use. of seasoned javascript developers on stack on flow feel sam? i've read should not create global variables, , global functions.

my last question is, how know function should implement in code? i'm kind of confusued, , use help. thank you.


Comments

Popular posts from this blog

php - Passing multiple values in a url using checkbox -

compilation - PHP install fails on Ubuntu 14 (make: *** [sapi/cli/php] Error 1) PHP 5.6.20 -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -