DEV Community

Discussion on: What's the Craziest Variable or Function Name You've Encountered?

Collapse
 
kenbellows profile image
Ken Bellows

I'll be honest... I never realized that string properties could be declared that way in javascript, with no square brackets or anything

const me = {
    'say hello'(name) {
        console.log('Hello', name)
    }
}
me['say hello']('Mitch')
// logs 'Hello Mitch'
Enter fullscreen mode Exit fullscreen mode