How to calculate length? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to calculate length?

<script> var num1= [1,2]; var num2=[3,4]; var set=num1+ num2 ; document.write(set.length); </script>

2nd May 2019, 4:22 PM
KHUSHbu
KHUSHbu - avatar
4 Answers
+ 1
num1.push(num2)
2nd May 2019, 4:48 PM
Basel.Al_hajeri?.MBH()
Basel.Al_hajeri?.MBH() - avatar
+ 1
You mean the length or the result
2nd May 2019, 4:48 PM
Basel.Al_hajeri?.MBH()
Basel.Al_hajeri?.MBH() - avatar
+ 1
Both
2nd May 2019, 4:49 PM
KHUSHbu
KHUSHbu - avatar
0
If you want Merge two array you must define array in first , for your case you must define var set =new Array(4); Now you allocated Then you must using for loop to put num1 and num2 to empty Array set
2nd May 2019, 4:41 PM
Mohammed Mizory
Mohammed Mizory - avatar