In Ruby, if I want to modify a string and have it change the original string, I can use the ! bang character.
string = "hello"
string.capitalize!
> "Hello"
string
> "Hello"
In JavaScript, I can't find this equivalence. Modifying a string to be upperCase for instance returns the original string after the first instance.
var string = "hello";
string.toUpperCase();
> "HELLO"
string
> "hello"
I know I can save it as a variable such as
var upperCaseString = string.toUpperCase();
but this seems inefficient and is undesirable for my purposes.
I know it must be obvious, but what am I missing?