function isNegativeInteger(s) {
if (typeof s !== 'string') {
return false;
}
const n = Number(s);
if (Number.isInteger(n) && n < 0) {
return true;
}
return false;
}
console.log(isNegativeInteger('0'));
console.log(isNegativeInteger('1'));
console.log(isNegativeInteger('-5'));
console.log(isNegativeInteger('-3.14'));
console.log(isNegativeInteger(''));
console.log(isNegativeInteger('abc'));
console.log(isNegativeInteger(' '));
/*
run:
false
false
true
false
false
false
false
*/