Quick actions

cmd+k|ctrl+k

Navigation

Languages

Rest Parameter

Snippet info

Language

JavaScript

Visibility

public

Author

asepkhabril20

Created

2024-11-05T07:36:54.099453Z

Updated

2024-11-05T07:36:54.099453Z

const str = "hello";
const charArray = [...str];

console.log(charArray.reverse()); // Output: ["h", "e", "l", "l", "o"]

const person = {
    firstName: "Alice",
    lastName: "Smith",
    fullName: function(firstName, lastName) {
        if(firstName !== undefined && lastName !== undefined){
             return firstName + ' ' + lastName;  
       
            
        }
        else{
          return this.firstName + " " + this.lastName;
        }
    }
};

const anotherPerson = {
    firstName: "Bob",
    lastName: "Brown"
};

// console.log(person.fullName.apply(anotherPerson)); // Output: "Bob Brown"
// console.log(person.fullName('Asep',''))
console.log(Object.values(person))

INFO