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

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

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

asp.net mvc - breakpoint on javascript in CSHTML? -