O'Reilly logo
  • Levine Veblen thinks this is interesting:

You may expect val to get shadowed by the inner definition of the scope variable, but as the default parameters have their own scope, the value assigned to val is unaffected by the inner scope.

From

Cover of Object-Oriented JavaScript - Third Edition

Note

默认参数有自身的作用域