I am learning javascript. In one of the document, I read we can modify the length of array. I tried as below and it worked.
var array = new Array(1, 2, 3, 4 ,5);
array.length = 4;
Now array becomes [1, 2, 3, 4].
But the same is not working on Strings.
var str = new String("abcdef");
str.length = 5;
str is not getting modified. Is there any specific reason to not allow this behavior on strings?