
- 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
What is the 'new' keyword in JavaScript?
The new keyword in JavaScript is the new operator. It creates an instance of a user-defined object type.
Here’s the syntax:
new constructor[([arguments])]
Example
Let us see an example to learn about the usage of 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>
- Related Articles
- What is the use of ‘new’ keyword in C#?
- What is the yield keyword in JavaScript?
- Creating a JavaScript array with new keyword.
- What is the 'new' keyword in JavaScript to create an object and how to access values?
- New keyword in Java
- Using the new keyword in C#
- What is the usage of yield keyword in JavaScript?
- What is the purpose of the var keyword in JavaScript?
- What is the purpose of new Boolean() in JavaScript?
- What is the “get” keyword before a function in a class - JavaScript?
- What is 'new' Operator in JavaScript?
- JavaScript: lexical scoping issue using new keyword constructor while adding inner function?
- What is the const Keyword in C++?
- What is the Background keyword in Cucumber?
- What is the Example keyword in Cucumber?

Advertisements