
- 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 recognize when to use : or = in JavaScript?
The colon (:) can be used when you want to define the property to an object while equal (=) can be used when you want to assign a value to a variable.
Example
Following is the code −
var studentDetails = { "studentId": 101, "studentName": "John", "studentSubjectName": "Javascript", "studentCountryName": "US" } console.log(studentDetails); var firstName = "David"; console.log(firstName);
To run the above program, you need to use the below command −
node fileName.js.
Here, my file name is demo325.js.
Output
This will produce the following output −
PS C:\Users\Amit\javascript-code> node demo325.js { studentId: 101, studentName: 'John', studentSubjectName: 'Javascript', studentCountryName: 'US' } David
- Related Articles
- How to use Turing machines to recognize languages in TOC?
- When to use i++ or ++i in C++?
- When and how to use pack or grid layouts in tkinter?
- When to use anonymous JavaScript functions?
- How to use OR condition in a JavaScript IF statement?
- How to recognize mood disorder and treat it?
- How to recognize and protect yourself from Cybercrime?
- How to Recognize and Reduce Water Retention (Edema)?
- How to use spread operator to join two or more arrays in JavaScript?
- When should I use an Inline script and when to use external JavaScript file?
- Getting Safari to recognize HTML 5
- How do I get IntelliJ to recognize common Python modules?
- How to use polyfill in JavaScript?
- How to use Ejs in JavaScript?
- How to use JavaScript to hide a DIV when the user clicks outside of it?

Advertisements