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 test(description, expectedResult, result) {
  if(expectedResult === result) {
    console.log(`${description} passed`);
  } else {
    console.log(`${description} failed. Expected ${result} to be ${expectedResult}`);
  }
}
function sum(number1, number2) { 
  return number1 + number2; 
}
test('sum of following numbers: "2,2" is 4', 4, sum(2, 2));
test('sum of following numbers: "2,3" is 5', 5, sum(2, 3));
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers