Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to write an object in javascript?

const person = {
  name: 'Nick'
};
person.name = 'John' // this will work ! person variable is not completely reassigned, but mutated
console.log(person.name) // "John"
person = "Sandra" // raises an error, because reassignment is not allowed with const declared variables
Source by mbeaudru.github.io #
 
PREVIOUS NEXT
Tagged: #write #object
ADD COMMENT
Topic
Name
1+6 =