Comment

Comment by aerovistae

The first code example he uses immediately threw me for a loop. Why is he adding the return value of a function call to a function itself? bar() + bar????

function bar(someNumber: number)

{

  return foo(someNumber) + 1;  
}

function baz(someNumber: number) {

  return bar(someNumber) + bar; 
}

baz();

Moreover, baz is called with its only argument being undefined-- so the exception throwing code won't even throw, because it isn't 0. And _moreover_, this is typescript, so this would have thrown a type error since a required numeric argument is omitted.

This has so many problems. This is not a promising start to this article's correctness or thought-outtedness. Yet here it is at the top of hacker news...

parent aerovistae 6 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton