In perl we can declare the array with qw
or quote word
take make each word is taken into individual array cell.
eg.
my @arr= qw( hello
world)
or else you need to quote each word eg
my @arr = ("hello" , "word");
Is there something similar in javascript as sometime it need lot of formatting to simple declare array.
This is what you need, for this specific case: const arr = 'hello world'.split(' ');
.
Edit:
Check out the docs for String.split
on MDN. Also, read something on types in JavaScript, if you are wondering why it is possible to call this method on string literal, as I did.