Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
function nonStrictSum(a, b) {
  // non-strict mode
  console.log(this === window); // => true
  return a + b;
}
function strictSum(a, b) {
  'use strict';
  // strict mode is enabled
  console.log(this === undefined); // => true
  return a + b;
}
// nonStrictSum() is invoked as a function in non-strict mode
// this in nonStrictSum() is the window object
console.log(nonStrictSum(5, 6)); // => 11
// strictSum() is invoked as a function in strict mode
// this in strictSum() is undefined
console.log(strictSum(8, 12)); // => 20
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
panzerdppro
0viewers