0
The number of values between braces { } must not exceed the number of the elements. What if the No of elements less
4 Respuestas
+ 2
Which language?
0
In Java, using less elements than the array is declared to hold, will assign any un-assigned elements as their “default” value for example:
int[] arr = new int[2];
arr[0] = 10;
arr[0] will return 10 and by default, arr[1] will return 0 if not assigned
0
If you are talking about JavaScript, objects have no limit on what they can hold.
Example of creating new item:
var object1 = {};
function func1(){
let x = “newItem”;
let y = 5;
object1[x] = y;
};
func1();
Returns object1 as:
object1 = { newItem: 5 }
0
ThNks everyone you are so good