input
!isNaN[input]
hoặc +input===+input
+input===+input
!isNaN[
/**
* Note: JavaScript does not print numeric separator inside a number.
* In that single case, the markdown output was manually corrected.
* Also, the comments were manually added later, of course.
*/
let inputs = [
123, '123', 12.3, '12.3', ' 12.3 ',
1_000_000, '1_000_000',
'0b11111111', '0o377', '0xFF',
'', ' ',
'abc', '12.34Ab!@#$',
'10e100', '10e1000',
null, undefined, Infinity];
let markdownOutput = `| \`input\` | \`!isNaN[input]\` or
\`+input === +input\` | \`!isNaN[parseFloat[input]]\` | \`isFinite[input]\` | Comment |
| :---: | :---: | :---: | :---: | :--- |\n`;
for [let input of inputs] {
let outputs = [];
outputs.push[!isNaN[input]];
outputs.push[!isNaN[parseFloat[input]]];
outputs.push[isFinite[input]];
if [typeof input === 'string'] {
// Output with quotations
console.log[`'${input}'`];
markdownOutput += `| '${input}'`;
} else {
// Output without quotes
console.log[input];
markdownOutput += `| ${input}`;
}
for [let output of outputs] {
console.log['\t' + output];
if [output === true] {
markdownOutput += ` | true
`;
// markdownOutput += ` | ✔️`; // for stackoverflow
} else {
markdownOutput += ` | false
`;
// markdownOutput += ` | ❌`; // for stackoverflow
}
}
markdownOutput += ` ||\n`;
}
// Replace two or more whitespaces with $nbsp;
markdownOutput = markdownOutput.replaceAll[` `, ` `];
// Print markdown to console
console.log[markdownOutput];
0/**
* Note: JavaScript does not print numeric separator inside a number.
* In that single case, the markdown output was manually corrected.
* Also, the comments were manually added later, of course.
*/
let inputs = [
123, '123', 12.3, '12.3', ' 12.3 ',
1_000_000, '1_000_000',
'0b11111111', '0o377', '0xFF',
'', ' ',
'abc', '12.34Ab!@#$',
'10e100', '10e1000',
null, undefined, Infinity];
let markdownOutput = `| \`input\` | \`!isNaN[input]\` or
\`+input === +input\` | \`!isNaN[parseFloat[input]]\` | \`isFinite[input]\` | Comment |
| :---: | :---: | :---: | :---: | :--- |\n`;
for [let input of inputs] {
let outputs = [];
outputs.push[!isNaN[input]];
outputs.push[!isNaN[parseFloat[input]]];
outputs.push[isFinite[input]];
if [typeof input === 'string'] {
// Output with quotations
console.log[`'${input}'`];
markdownOutput += `| '${input}'`;
} else {
// Output without quotes
console.log[input];
markdownOutput += `| ${input}`;
}
for [let output of outputs] {
console.log['\t' + output];
if [output === true] {
markdownOutput += ` | true
`;
// markdownOutput += ` | ✔️`; // for stackoverflow
} else {
markdownOutput += ` | false
`;
// markdownOutput += ` | ❌`; // for stackoverflow
}
}
markdownOutput += ` ||\n`;
}
// Replace two or more whitespaces with $nbsp;
markdownOutput = markdownOutput.replaceAll[` `, ` `];
// Print markdown to console
console.log[markdownOutput];
1
/**
* Note: JavaScript does not print numeric separator inside a number.
* In that single case, the markdown output was manually corrected.
* Also, the comments were manually added later, of course.
*/
let inputs = [
123, '123', 12.3, '12.3', ' 12.3 ',
1_000_000, '1_000_000',
'0b11111111', '0o377', '0xFF',
'', ' ',
'abc', '12.34Ab!@#$',
'10e100', '10e1000',
null, undefined, Infinity];
let markdownOutput = `| \`input\` | \`!isNaN[input]\` or
\`+input === +input\` | \`!isNaN[parseFloat[input]]\` | \`isFinite[input]\` | Comment |
| :---: | :---: | :---: | :---: | :--- |\n`;
for [let input of inputs] {
let outputs = [];
outputs.push[!isNaN[input]];
outputs.push[!isNaN[parseFloat[input]]];
outputs.push[isFinite[input]];
if [typeof input === 'string'] {
// Output with quotations
console.log[`'${input}'`];
markdownOutput += `| '${input}'`;
} else {
// Output without quotes
console.log[input];
markdownOutput += `| ${input}`;
}
for [let output of outputs] {
console.log['\t' + output];
if [output === true] {
markdownOutput += ` | true
`;
// markdownOutput += ` | ✔️`; // for stackoverflow
} else {
markdownOutput += ` | false
`;
// markdownOutput += ` | ❌`; // for stackoverflow
}
}
markdownOutput += ` ||\n`;
}
// Replace two or more whitespaces with $nbsp;
markdownOutput = markdownOutput.replaceAll[` `, ` `];
// Print markdown to console
console.log[markdownOutput];
0
/**
* Note: JavaScript does not print numeric separator inside a number.
* In that single case, the markdown output was manually corrected.
* Also, the comments were manually added later, of course.
*/
let inputs = [
123, '123', 12.3, '12.3', ' 12.3 ',
1_000_000, '1_000_000',
'0b11111111', '0o377', '0xFF',
'', ' ',
'abc', '12.34Ab!@#$',
'10e100', '10e1000',
null, undefined, Infinity];
let markdownOutput = `| \`input\` | \`!isNaN[input]\` or
\`+input === +input\` | \`!isNaN[parseFloat[input]]\` | \`isFinite[input]\` | Comment |
| :---: | :---: | :---: | :---: | :--- |\n`;
for [let input of inputs] {
let outputs = [];
outputs.push[!isNaN[input]];
outputs.push[!isNaN[parseFloat[input]]];
outputs.push[isFinite[input]];
if [typeof input === 'string'] {
// Output with quotations
console.log[`'${input}'`];
markdownOutput += `| '${input}'`;
} else {
// Output without quotes
console.log[input];
markdownOutput += `| ${input}`;
}
for [let output of outputs] {
console.log['\t' + output];
if [output === true] {
markdownOutput += ` | true
`;
// markdownOutput += ` | ✔️`; // for stackoverflow
} else {
markdownOutput += ` | false
`;
// markdownOutput += ` | ❌`; // for stackoverflow
}
}
markdownOutput += ` ||\n`;
}
// Replace two or more whitespaces with $nbsp;
markdownOutput = markdownOutput.replaceAll[` `, ` `];
// Print markdown to console
console.log[markdownOutput];
1/**
* Note: JavaScript does not print numeric separator inside a number.
* In that single case, the markdown output was manually corrected.
* Also, the comments were manually added later, of course.
*/
let inputs = [
123, '123', 12.3, '12.3', ' 12.3 ',
1_000_000, '1_000_000',
'0b11111111', '0o377', '0xFF',
'', ' ',
'abc', '12.34Ab!@#$',
'10e100', '10e1000',
null, undefined, Infinity];
let markdownOutput = `| \`input\` | \`!isNaN[input]\` or
\`+input === +input\` | \`!isNaN[parseFloat[input]]\` | \`isFinite[input]\` | Comment |
| :---: | :---: | :---: | :---: | :--- |\n`;
for [let input of inputs] {
let outputs = [];
outputs.push[!isNaN[input]];
outputs.push[!isNaN[parseFloat[input]]];
outputs.push[isFinite[input]];
if [typeof input === 'string'] {
// Output with quotations
console.log[`'${input}'`];
markdownOutput += `| '${input}'`;
} else {
// Output without quotes
console.log[input];
markdownOutput += `| ${input}`;
}
for [let output of outputs] {
console.log['\t' + output];
if [output === true] {
markdownOutput += ` | true
`;
// markdownOutput += ` | ✔️`; // for stackoverflow
} else {
markdownOutput += ` | false
`;
// markdownOutput += ` | ❌`; // for stackoverflow
}
}
markdownOutput += ` ||\n`;
}
// Replace two or more whitespaces with $nbsp;
markdownOutput = markdownOutput.replaceAll[` `, ` `];
// Print markdown to console
console.log[markdownOutput];
2/**
* Note: JavaScript does not print numeric separator inside a number.
* In that single case, the markdown output was manually corrected.
* Also, the comments were manually added later, of course.
*/
let inputs = [
123, '123', 12.3, '12.3', ' 12.3 ',
1_000_000, '1_000_000',
'0b11111111', '0o377', '0xFF',
'', ' ',
'abc', '12.34Ab!@#$',
'10e100', '10e1000',
null, undefined, Infinity];
let markdownOutput = `| \`input\` | \`!isNaN[input]\` or
\`+input === +input\` | \`!isNaN[parseFloat[input]]\` | \`isFinite[input]\` | Comment |
| :---: | :---: | :---: | :---: | :--- |\n`;
for [let input of inputs] {
let outputs = [];
outputs.push[!isNaN[input]];
outputs.push[!isNaN[parseFloat[input]]];
outputs.push[isFinite[input]];
if [typeof input === 'string'] {
// Output with quotations
console.log[`'${input}'`];
markdownOutput += `| '${input}'`;
} else {
// Output without quotes
console.log[input];
markdownOutput += `| ${input}`;
}
for [let output of outputs] {
console.log['\t' + output];
if [output === true] {
markdownOutput += ` | true
`;
// markdownOutput += ` | ✔️`; // for stackoverflow
} else {
markdownOutput += ` | false
`;
// markdownOutput += ` | ❌`; // for stackoverflow
}
}
markdownOutput += ` ||\n`;
}
// Replace two or more whitespaces with $nbsp;
markdownOutput = markdownOutput.replaceAll[` `, ` `];
// Print markdown to console
console.log[markdownOutput];
3
/**
* Note: JavaScript does not print numeric separator inside a number.
* In that single case, the markdown output was manually corrected.
* Also, the comments were manually added later, of course.
*/
let inputs = [
123, '123', 12.3, '12.3', ' 12.3 ',
1_000_000, '1_000_000',
'0b11111111', '0o377', '0xFF',
'', ' ',
'abc', '12.34Ab!@#$',
'10e100', '10e1000',
null, undefined, Infinity];
let markdownOutput = `| \`input\` | \`!isNaN[input]\` or
\`+input === +input\` | \`!isNaN[parseFloat[input]]\` | \`isFinite[input]\` | Comment |
| :---: | :---: | :---: | :---: | :--- |\n`;
for [let input of inputs] {
let outputs = [];
outputs.push[!isNaN[input]];
outputs.push[!isNaN[parseFloat[input]]];
outputs.push[isFinite[input]];
if [typeof input === 'string'] {
// Output with quotations
console.log[`'${input}'`];
markdownOutput += `| '${input}'`;
} else {
// Output without quotes
console.log[input];
markdownOutput += `| ${input}`;
}
for [let output of outputs] {
console.log['\t' + output];
if [output === true] {
markdownOutput += ` | true
`;
// markdownOutput += ` | ✔️`; // for stackoverflow
} else {
markdownOutput += ` | false
`;
// markdownOutput += ` | ❌`; // for stackoverflow
}
}
markdownOutput += ` ||\n`;
}
// Replace two or more whitespaces with $nbsp;
markdownOutput = markdownOutput.replaceAll[` `, ` `];
// Print markdown to console
console.log[markdownOutput];
3Bình luận|
'123' | ✔ | ✔ | '12 .3 ' | '& nbsp; & nbsp; 12.3 & nbsp; & nbsp; ' Though not as crazy as it may seem. In JavaScript, a value larger than ~10308 is rounded to infinity, that's why. Look here for details. And yes, /**
* Note: JavaScript does not print numeric separator inside a number.
* In that single case, the markdown output was manually corrected.
* Also, the comments were manually added later, of course.
*/
let inputs = [
123, '123', 12.3, '12.3', ' 12.3 ',
1_000_000, '1_000_000',
'0b11111111', '0o377', '0xFF',
'', ' ',
'abc', '12.34Ab!@#$',
'10e100', '10e1000',
null, undefined, Infinity];
let markdownOutput = `| \`input\` | \`!isNaN[input]\` or \`+input === +input\` | \`!isNaN[parseFloat[input]]\` | \`isFinite[input]\` | Comment |
| :---: | :---: | :---: | :---: | :--- |\n`;
for [let input of inputs] {
let outputs = [];
outputs.push[!isNaN[input]];
outputs.push[!isNaN[parseFloat[input]]];
outputs.push[isFinite[input]];
if [typeof input === 'string'] {
// Output with quotations
console.log[`'${input}'`];
markdownOutput += `| '${input}'`;
} else {
// Output without quotes
console.log[input];
markdownOutput += `| ${input}`;
}
for [let output of outputs] {
console.log['\t' + output];
if [output === true] {
markdownOutput += ` | true `;
// markdownOutput += ` | ✔️`; // for stackoverflow
} else {
markdownOutput += ` | false `;
// markdownOutput += ` | ❌`; // for stackoverflow
}
}
markdownOutput += ` ||\n`;
}
// Replace two or more whitespaces with $nbsp;
markdownOutput = markdownOutput.replaceAll[` `, ` `];
// Print markdown to console
console.log[markdownOutput];
5 considers infinity as a number, and /**
* Note: JavaScript does not print numeric separator inside a number.
* In that single case, the markdown output was manually corrected.
* Also, the comments were manually added later, of course.
*/
let inputs = [
123, '123', 12.3, '12.3', ' 12.3 ',
1_000_000, '1_000_000',
'0b11111111', '0o377', '0xFF',
'', ' ',
'abc', '12.34Ab!@#$',
'10e100', '10e1000',
null, undefined, Infinity];
let markdownOutput = `| \`input\` | \`!isNaN[input]\` or \`+input === +input\` | \`!isNaN[parseFloat[input]]\` | \`isFinite[input]\` | Comment |
| :---: | :---: | :---: | :---: | :--- |\n`;
for [let input of inputs] {
let outputs = [];
outputs.push[!isNaN[input]];
outputs.push[!isNaN[parseFloat[input]]];
outputs.push[isFinite[input]];
if [typeof input === 'string'] {
// Output with quotations
console.log[`'${input}'`];
markdownOutput += `| '${input}'`;
} else {
// Output without quotes
console.log[input];
markdownOutput += `| ${input}`;
}
for [let output of outputs] {
console.log['\t' + output];
if [output === true] {
markdownOutput += ` | true `;
// markdownOutput += ` | ✔️`; // for stackoverflow
} else {
markdownOutput += ` | false `;
// markdownOutput += ` | ❌`; // for stackoverflow
}
}
markdownOutput += ` ||\n`;
}
// Replace two or more whitespaces with $nbsp;
markdownOutput = markdownOutput.replaceAll[` `, ` `];
// Print markdown to console
console.log[markdownOutput];
4 parses infinity as infinity.
|
Khoảng trắng rỗng được cắt tỉa, như mong đợi. | ✔ | '12 .3 ' | ✔ | - Then why /**
* Note: JavaScript does not print numeric separator inside a number.
* In that single case, the markdown output was manually corrected.
* Also, the comments were manually added later, of course.
*/
let inputs = [
123, '123', 12.3, '12.3', ' 12.3 ',
1_000_000, '1_000_000',
'0b11111111', '0o377', '0xFF',
'', ' ',
'abc', '12.34Ab!@#$',
'10e100', '10e1000',
null, undefined, Infinity];
let markdownOutput = `| \`input\` | \`!isNaN[input]\` or \`+input === +input\` | \`!isNaN[parseFloat[input]]\` | \`isFinite[input]\` | Comment |
| :---: | :---: | :---: | :---: | :--- |\n`;
for [let input of inputs] {
let outputs = [];
outputs.push[!isNaN[input]];
outputs.push[!isNaN[parseFloat[input]]];
outputs.push[isFinite[input]];
if [typeof input === 'string'] {
// Output with quotations
console.log[`'${input}'`];
markdownOutput += `| '${input}'`;
} else {
// Output without quotes
console.log[input];
markdownOutput += `| ${input}`;
}
for [let output of outputs] {
console.log['\t' + output];
if [output === true] {
markdownOutput += ` | true `;
// markdownOutput += ` | ✔️`; // for stackoverflow
} else {
markdownOutput += ` | false `;
// markdownOutput += ` | ❌`; // for stackoverflow
}
}
markdownOutput += ` ||\n`;
}
// Replace two or more whitespaces with $nbsp;
markdownOutput = markdownOutput.replaceAll[` `, ` `];
// Print markdown to console
console.log[markdownOutput];
7 should return a /**
* Note: JavaScript does not print numeric separator inside a number.
* In that single case, the markdown output was manually corrected.
* Also, the comments were manually added later, of course.
*/
let inputs = [
123, '123', 12.3, '12.3', ' 12.3 ',
1_000_000, '1_000_000',
'0b11111111', '0o377', '0xFF',
'', ' ',
'abc', '12.34Ab!@#$',
'10e100', '10e1000',
null, undefined, Infinity];
let markdownOutput = `| \`input\` | \`!isNaN[input]\` or \`+input === +input\` | \`!isNaN[parseFloat[input]]\` | \`isFinite[input]\` | Comment |
| :---: | :---: | :---: | :---: | :--- |\n`;
for [let input of inputs] {
let outputs = [];
outputs.push[!isNaN[input]];
outputs.push[!isNaN[parseFloat[input]]];
outputs.push[isFinite[input]];
if [typeof input === 'string'] {
// Output with quotations
console.log[`'${input}'`];
markdownOutput += `| '${input}'`;
} else {
// Output without quotes
console.log[input];
markdownOutput += `| ${input}`;
}
for [let output of outputs] {
console.log['\t' + output];
if [output === true] {
markdownOutput += ` | true `;
// markdownOutput += ` | ✔️`; // for stackoverflow
} else {
markdownOutput += ` | false `;
// markdownOutput += ` | ❌`; // for stackoverflow
}
}
markdownOutput += ` ||\n`;
}
// Replace two or more whitespaces with $nbsp;
markdownOutput = markdownOutput.replaceAll[` `, ` `];
// Print markdown to console
console.log[markdownOutput];
8 here? Someone please explain this design concept to me.
|