javascript - Return not working as expected -


var car = function (year, make, model) {          var printc = "you car is" + this.year + this.make + this.model;              return printc;     } var mycar = new car(2010, "hyundai", "elantra"); console.log(mycar.printc); 

console.log printing undefined. why? expected output : you car 2010 hyundai elantra

var car = function (year, make, model) {      var printc = "you car is" + year + make + model;          return printc; }  var mycar = car(2010, "hyundai", "elantra"); console.log(mycar); 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -