I understand it is confusing; the easy explanation is that is an order of operations
, and the type-conversion is done before the type-evaluation.
I spaced it out to show you how this is being evaluated in your last 2 lines of codes
console.log( typeof (100).toString() );
console.log( (typeof(100)) .toString() );