Answers for "instance of js"

1

instanceof

function Phone(serial, price, color){
  this.serial = serial;
  this.price = price;
  this.color = color;
}

let phone1 = new Phone('abc1', 200, 'red');
let phone2 = new Phone('abc2', 400, 'green');

//instanceof 
console.log(phone1 instanceof Phone) // true

//constructor
console.log(phone1.constructor === Phone) //true
Posted by: Guest on July-24-2021
0

what is instance in javascript

In JavaScript, "instance" does not have this technical meaning because 
JavaScript does not have this difference between classes and instances.
However, in talking about JavaScript, "instance" can be used informally
to mean an object created using a particular constructor function.
Posted by: Guest on August-13-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language