1
0
Fork 0
mirror of https://gitlab.com/mfocko/CodeWars.git synced 2024-09-16 20:56:57 +02:00
CodeWars/6kyu/are_they_the_same/solution.js
Matej Focko fc899b0b02
chore: initial commit
Signed-off-by: Matej Focko <mfocko@redhat.com>
2021-12-28 16:19:58 +01:00

16 lines
332 B
JavaScript

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;
}