<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JS test</title>
</head>
<body>
<script type="text/javascript">
let num = prompt('введите число:', 0);
if ( num = Number(num) ){
alert('in if');
if (num > 0) {
alert(typeof(num));
alert('1');
}else if (num < 0){
alert(typeof(num));
alert('-1');
}else if(num == 0){
alert('0');
}
}else{
alert('in else');
alert(typeof(num));
alert('Это не число!');
}
</script>
</body>
</html>
false
, null
, 0
, 0n
, ""
, NaN
, undefined
.if ( num = Number(num) ){
if ( (num = Number(num)) || num === 0 ){