9 ms·
Runnable code snippets are helpful in this regard, but even better would be runnable test cases. Example: How to check for Invalid Date in JS? ```js function
by mLuby 7y ago
Runnable code snippets are helpful in this regard, but even better would be runnable test cases.
Example: How to check for Invalid Date in JS?
```js
function invalidDate (date){return isNaN(date.valueOf())}
console.assert(invalidDate(new Date("foo")) === true)
console.assert(invalidDate(new Date()) === false)
```
But I'd expect if someone noticed an out-of-date answer they'd just comment and it'd get fixed that way.