Skip to content

Instantly share code, notes, and snippets.

@subwaymatch
Last active July 14, 2020 14:43
Show Gist options
  • Save subwaymatch/eb28ade29714b11c478576dbe386067e to your computer and use it in GitHub Desktop.
Save subwaymatch/eb28ade29714b11c478576dbe386067e to your computer and use it in GitHub Desktop.
Without a type check, you may mistakenly think that this code would print out 30.
function addTwoNumbers(num1, num2) {
return num1 + num2;
}
let result = addTwoNumbers('10', 20);
console.log(`Result: ${result}`);
console.log(`Return Type: ${typeof result}`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment