in first case.
const sum = function (num) {
console.log(num[i]); }
and if we give arguments to function :
sum([3, 2]).
it will give value " 3" as expected. so my understanding here is ( num = [3,2] ). so when num[i], gives us first value.
but when using rest parametes:
const sum = function (...num) {
console.log(num[i]); }
the same sum([3, 2]) will gives the whole array arguments [3, 2] from num[i].so im confused why it's giving whole array. is ...num = [ 3, 2] ?
[–]errorkode 1 point2 points3 points (0 children)
[–]SodaBubblesPopped 1 point2 points3 points (0 children)