function add(num1, num2) {
  return num1 + num2;
}
var x = add(3, '0');
console.log(x);
  1. 3

  2. "30"

  3. undefined

What is the value of X?

/* @flow */
function add(num1: number, num2: number): number {
  return num1 + num2;
}
var x: number = add(3, '0');
console.log(x);

Using FLOW 

file.js:5
  5: var x: number = add(3, '0');
                     ^^^^^^^^^^^ function call
  5: var x: number = add(3, '0');
                            ^^^ string. This type is incompatible with
  2: function add(num1: number, num2: number): number {
                                      ^^^^^^ number


Found 1 error

Flow Code Example

By Kevin C.

Flow Code Example

  • 630