1
0
Fork 0
mirror of https://gitlab.com/mfocko/CodeWars.git synced 2024-11-09 19:19:07 +01:00
CodeWars/6kyu/are_they_the_same/solution.js

17 lines
332 B
JavaScript
Raw Normal View History

function comp(array1, array2){
let squares = [];
for (let num of array1) {
squares.push(num * num);
}
if (!array2)
return false;
for (let square of array2) {
let index = squares.indexOf(square);
if (index != -1) squares.splice(index, 1);
}
if (squares.length > 0) return false;
else return true;
}