JSFiddle - React, Tailwind, and code Playground

by luka kupunia

JavaScript

function comp(array1, array2) {
  let arr = new Set(array2);
  let result = true;

	let test = array1.filter(el => arr.has(el * el))
	if(test.length === array1.length) return true
  return false
}
comp([121, 144, 19, 161, 19, 144, 19, 11], [121, 14641, 20736, 361, 25921, 361, 20736, 361])