Arrays

node v10.24.1
version: 4.0.1
endpointsharetweet
Пример
var A = [1, 2, 3] var B = [] for (var i = 0; i < A.length; i++) { B[i] = A[i] * 2 console.log(B) }
Задача 1
var A = [1, 2, 3, 4] var B = [2, 3, 4, 5] var C = [] // [3, 5, 7, 9] (1+2, 2+3, 3+4, 4+5)
Задача 2
var A = [1, 2, 3, 4] var B = [1, 2, 3, 4] var C = [] // [5, 5, 5, 5] (1+4, 2+3, 3+2, 4+1)
Задача 3
var A = [1, 2, 3, 4, 5, 6] var B = [] // [6, 9, 13] (1+2+3, 2+3+4, 3+4+6)
Loading…

no comments

    sign in to comment