Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE HTML>
<html>
<head>
<meta name="description" content="memoization ala SOTJN" />
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
  
  <div id="content"></div>
</body>
</html>
 
var module = (function(){
  var myObj = {
     "chkOne" : "HV1",
     "chkTwo" : "HV2",
     "chkThree" : "HV3"
   };
  return {
    mapVals: function (ele){      
      var thisVal = myObj[ele.id];
   }, 
    setVal: function (prop,value) {
      myObj[prop] = value;
    },
    getVal : function (val) {
      return myObj[val];
    }
  };
   
})();
module.mapVals('chkOne');
module.setVal('foo','bar');
console.log(module.getVal('foo'));
Output

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

Dismiss x
public
Bin info
NickTomlinpro
0viewers