Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0613· OpenAIAi2 WildChat-4.8M (AI2)

js: need to create a constructor for Laptop with properties (Manufacture, memory,…

  1. User

    js: need to create a constructor for Laptop with properties (Manufacture, memory, capacity, display). create 2 objects

  2. Assistant

    Sure, here's an example of creating a constructor for the Laptop with the specified properties:

    function Laptop(manufacture, memory, capacity, display) {
      this.manufacture = manufacture;
      this.memory = memory;
      this.capacity = capacity;
      this.display = display;
    }
    
    // Creating two Laptop objects
    var laptop1 = new Laptop("Dell", "8GB", "1TB", "15 inches");
    var laptop2 = new Laptop("HP", "16GB", "512GB", "13 inches");