I want to call name property in another key. Is it possible? If yes, then how can we achieve this?
let user = {
        name: "John",
        age: this.name,  
      };
      console.warn(user)
I want to call name property in another key. Is it possible? If yes, then how can we achieve this?
let user = {
        name: "John",
        age: this.name,  
      };
      console.warn(user)
 
    
     
    
    Do you mean like this? What is it you are trying to achieve?
let userA = {
        name: "John",
        age: 8 
      };
      
let user = {
        name: "John",
        age: userA.name 
      };
console.log(user) 
    
    I am not in a position to test it at the moment, but I think, in theory, this should work:
let user = { 
  name: "John" 
}; 
user.age = user.name
console.log(user.age);
// output: John
