call js

Solutions on MaxInterview for call js by the best coders in the world

showing results for - "call js"
Facundo
20 Nov 2016
1function Product(name, price) {
2  this.name = name;
3  this.price = price;
4
5  if (price < 0)
6    throw RangeError('Cannot create product "' + name + '" with a negative price');
7  return this;
8}
9
10function Food(name, price) {
11  Product.call(this, name, price);
12  this.category = 'food';
13}
14Food.prototype = new Product();
15
16function Toy(name, price) {
17  Product.call(this, name, price);
18  this.category = 'toy';
19}
20Toy.prototype = new Product();
21
22var cheese = new Food('feta', 5);
23var fun = new Toy('robot', 40);
Victoria
27 Jan 2020
1// let us see what exactly CALL, BIND method in JS
2
3/* NOTE : (CALL , APPLY executes immediately) and
4(BOUND - it returns bounded function that execute later)
5
6NOTE : call will take its additinal arguments just like that 
7	   eg : XYZ.call(this , a , b , c);
8       
9NOTE : apply will take its additinal arguments as an ARRAY
10       eg : XYZ.apply(this , [a , b , c])
11
12NOTE : All of them are for borrowing values(property and methods)
13	   from another function
14*/
15
16/*CALL method  {let's say we have constructor func}, we need all these
17properties and methods in another function, in that way CALL is 
18highly useful */
19function Person(name,place){
20    this.name = name;
21    this.place = place;
22    this.greet = function(){
23        return (`HEllo I am ${this.name} comes from ${this.place}`);
24    }
25};
26
27//I need above func prop,methods in below, let's see how to get
28function Teacher(name,place,sub){
29	this.sub = sub;
30 //since i get name,place from Person function I no need to mention here
31    Person.call(this , name , place); 
32  	this.greeting = function(){
33		return(`I am ${name}, from ${place} and I teach ${this.sub}`);
34	}
35 /* also here, we don't need to mention (this.name / this.place) because,
36   we call them here and (this) referes to current Teacher context. try 
37   inheriting below and check in console.
38 */
39}
40
41var Te1 = new Teacher("Ranjan" , "Salem" , "JavaScript");
42    Te1 // all prop and methods
43    Te1.name // Ranjan
44	Te1.place //Salem
45	Te1.greeting() // I am Ranjan, from Salem and I teach JavaScript
46
47
48
49
50// for BIND
51function Student(name,place,like){
52	this.like = like;
53 //since i get name,place from Person function I no need to mention here
54    Person.apply(this , [name , place]); 
55  	this.about_me = function(){
56		return(`My name is  ${name}, I come from ${place} and I
57                like to play${this.like}`);
58	}
59}
60  
61var Pe1 = new Student("Max" , "Mettur" , "Cricket");
62    Pe1 // all prop and methods
63    Pe1.name // Max
64  	Pe1.place // Metttur
65    Pe1.about_me() // My name is Max, I come from Mettur and I like to play cricket
queries leading to this page
call function in csscall javascripthow to call function jswhat is callin this jsjs call 28 29call 28 29 javascriptjavascript call functionjs call functionreturn in javascript function callhow to trigger function in javascriptcall method javascriptjs callwhat is call in javascriptjavascript for calljs method calljavascript calljavascrut callhow create and call function in javascriptfunction call javascript call function in javascriptcall jsscriptjavascript call the functionapply cal jscall a function from another function in javascriptcall a javascript function in htmljavsript calljavascript callhow to call javascript function in html call in jsjs call 28 29 methodcall variable from function javascriptcall function in javascriptjs calljavasctript function calljs callcall javascriptwhat is call method in javascriptaccess function javascriptjavascript function calluse of call in jswhat does call do javascriptcall 24 in jshow to call function in javascriptwhat is call in this jscall in javasript call js call in javascriptcreate function calling function javascriptjavascript trigger function when class calljs 3a callcall 28 29 28 29 javascriptjavascript callhow do i call a js method 3fcall 28 29 jsfunction call jsjs function calljavascript call methodcall function jsthe call method jsjs function callcall objecthow to call method in jswhat is call in jsuse function javascriptjavascript call java methodjava script callcall to jscall java scrip functionmake call javascriptjavscript call call method javascripthow to call a function in htmljavascript function callwhat call do in javascript call 28 29how to call a javascript methodfunction call in javascriptjavascript call function eventhow to call function in jsfunction calling with html object eventhow to call the function in javascriptcalling a function in node jsapply call jscall 28 29 in javascriptexecute a javascript function in htmljavascript call 28 29call function in jscall in js js call methodjavascript call create functionhow to make div call a function in javascriptcalling in jscall jscall javascript functionthis call jsjavascript get html element from function calljs call metod call javascriptcall javscriptcalling a javascript functionjavascript call function on 5chow to call tag in javascriptcall javascriotcall method in javascriptcall a function within a callcall method in function javascriptfunction call jscall funtion jscall in javascriptwhat does call do in javascriptcall 28 29 in jsjs callsrun a function csscall method in jscall en jscall js functioncall a method javascriptcall method jsjs call 28 29how to call a certain statement in javascripthow to call method in javascriptcall methode javascriptexecute a function javascriptcall scriptcall en javascriptcall jscall function javascriptcall js