Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript Add Symbol as an Object Key

let id = Symbol("id");

let person = {
    name: "Jack",

    // adding symbol as a key
    [id]: 123 // not "id": 123
};

console.log(person); // {name: "Jack", Symbol(id): 123}
Comment

PREVIOUS NEXT
Code Example
Javascript :: navlink react active class 
Javascript :: javascript Rename in the module 
Javascript :: javascript Passing Parameter as Default Values 
Javascript :: zigale assefa 
Javascript :: javascript remaining elements of an array to a variable using the spread syntax 
Javascript :: fetch second parameters 
Javascript :: javascript Duplicating a parameter name is not allowed 
Javascript :: how to locate an object with a spcific key in js array 
Javascript :: status role discord.js 
Javascript :: ejs split string 
Javascript :: jQuery Traversing - Descendants 
Javascript :: how to check if a number is divisible by 3 and 5 in javascript 
Javascript :: OpenTok Create Session 
Javascript :: how to send the captured image from js to python backedn flask 
Javascript :: regex tunisian phone number 
Javascript :: phaser rotate around x y point 
Javascript :: phaser pause all animations 
Javascript :: refresh secounds 
Javascript :: JS table with rows that have alternating colours 
Javascript :: javascript 2021 
Javascript :: marko js 
Javascript :: decimal to hex 
Javascript :: javascript check item is checkbox 
Javascript :: js brightness filter 
Javascript :: react native icons 
Javascript :: ` ` in javascript 
Javascript :: nodejs 
Javascript :: get element by id angular 
Javascript :: copy folder in nodejs 
Javascript :: javascript quiz questions and answers 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =