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>
 
var state = {
  0: "zero",
  1: "one",
  2: "two",
  x: "hello"
};
function removeByKey (myObj, deleteKey) {
  return Object.keys(myObj)
    .filter(key => key !== deleteKey)
    .reduce((result, current) => {
      result[current] = myObj[current];
      return result;
  }, {});
}
console.log("Current State:");
console.log(state);
var stateMinusFirst = removeByKey(state, "0");
console.log("State minus zero key:");
console.log(stateMinusFirst);
var stateMinusX = removeByKey(state, "x");
console.log("State minus x key:");
console.log(stateMinusX);
Output

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

Dismiss x
public
Bin info
sebkoubapro
0viewers