MongoDB Documentation, Release 3.0.4 function go () {}; } print( typeof go) } function test () { var go; if ( false ) { go = function () {} } print( typeof go) } function test () { 'use strict'; if ( false ) { function go () {} } } var name = 'MongoDB'; var lower = String.toLowerCase(name); var name = 'MongoDB'; var lower = name.toLowerCase(); print(name + ' becomes ' + lower); With V8, use the String instance method toLowerCase() available through an instance of the String class instead: The following use of the generic method String.toLowerCase() is invalid with V8: String Generic Methods V8 does not support String generics$^{812}$. String generics are a set of methods on the String class that mirror instance methods. SyntaxError: In strict mode code, functions can only be declared at top level or immediately The JavaScript code throws the following syntax error: Note: ECMAscript prohibits conditional function definitions. To force V8 to throw an Error , enable strict mode$^{811}$. The refactored code outputs undefined in both SpiderMonkey and V8. If your code defines functions this way, it is highly recommended that you refactor the code. The following example refactors the conditional function definition to work in both SpiderMonkey and V8. With SpiderMonkey, the conditional function outputs undefined , whereas with V8, the conditional function outputs function . Example $^{811}$http://www.nczonline.net/blog/2012/03/13/its-time-to-start-using-javascript-strict-mode/ $^{812}$https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String#String_generic_methods 889 12.2. Previous Stable Releases