Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
    function trackScore(change){
        trackScore.total += change;
        trackScore.changes.push(change);
    }
    trackScore.changes = [];
    trackScore.total = 1000;
    
    trackScore(-100);
    trackScore(+1100);
    console.log(trackScore.total);   // 2000
    console.log(trackScore.changes); // [-100,1100]
Output

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

Dismiss x
public
Bin info
shanimalpro
0viewers