How and why does 'z'['toUpperCase']() in JavaScript work?

JavascriptObject Oriented ProgrammingFront End Technology

The toUpperCase() method in JavaScript is used to convert a string in uppercase. Here, a is a primitive value. You can use it as the following −

'z'['toUpperCase'];

Or use the following via bracket notation −

'z'['toUpperCase']();

The code snippet is the same as the following to convert to upper case −

alert('z'.toUpperCase())
raja
Published on 27-Feb-2018 15:23:46
Advertisements