function solution(s) {
const num = Number(s);
const precision = s.length === 4 ? num.toPrecision(4) : num.toPrecision(6);
const result =
(isNaN(precision) !== true && precision.length === 4) ||
precision.length === 6
? true
: false;
return result;
}
function solution(s) {
const regex = /^\d{6}$|^\d{4}$/;
return regex.test(s);
}