
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
How to create JavaScript objects using new operator?
The new keyword in JavaScript is the new operator, which creates an instance of a user-defined object type.
Example
You can try to run the following code to create JavaScript objects using new operator −
<!DOCTYPE html> <html> <body> <p id = "test"></p> <script> var dept = new Object(); dept.employee = "Amit"; dept.department = "Technical"; dept.technology ="Java"; document.getElementById("test").innerHTML = dept.employee + " is working on " + dept.technology + " technology."; </script> </body> </html>
Output
Amit is working on Java technology.
- Related Articles
- Create class Objects in Java using new operator
- How to create JavaScript objects using object() constructor?
- Creating JavaScript constructor using the “new” operator?
- How to create objects in JavaScript?
- The new operator in JavaScript
- How to create dynamic values and objects in JavaScript?
- How to create instance Objects using __init__ in Python?
- How to create a new local group using PowerShell?
- How to create a third object from two objects using the key values in JavaScript?
- How to create a new object with only a subset of properties using vanilla Javascript
- What is 'new' Operator in JavaScript?
- How to compare two JavaScript array objects using jQuery/JavaScript?
- Difference between "new operator" and "operator new" in C++?
- How to create a new Azure resource group using PowerShell?
- How to create animations using JavaScript?

Advertisements