Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

set method in javascript

const language = {
  set current(name) {
    this.log.push(name);
  },
  log: []
};

language.current = 'EN';
language.current = 'FA';

console.log(language.log);
// expected output: Array ["EN", "FA"]
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #set #method #javascript
ADD COMMENT
Topic
Name
3+3 =