title: How to loop an object and remove all functions from it
body: <p>Let's get right the issue, I need to remove all functions from a object to send via socket.io JSON!
  Let's say I have an object such as...</p>
  
  <pre><code>let myObject = {
      test1: "abc",
      test2: function() {
          console.log("This is a function");
      },
      test3: {
          test4: "another string",
          test5: function() {
              console.log("another function");
          },
          test6: 123
      }
  }
  </code></pre>
  
  <p>and I need to convert it too</p>
  
  <pre><code>let myObject = {
      test1: "abc",
      test3: {
          test4: "another string",
          test6: 123
      }
  }
  </code></pre>
  
  <p>I have tried many cod methods, all of which failed!
  I would post them but that would be wasting your valuable time.
  I'd love anyone who could fix this problem in a neat function manner.
  Yours Truly, Jacob Morris</p>
  
  <p>P.S. Here is a piece of c**p attempt at doing this</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>let myObject = {
    test1: "abc",
    test2: function() {
        console.log("This is a function");
    },
    test3: {
        test4: "another string",
        test5: function() {
            console.log("another function");
        },
        test6: 123
    }
  }
  
  let i = [];
  function tsfr(ls) {
      let i = {};
      for (let a in ls) {
          if (typeof(ls[a]) !== "function") {
              let d = ls[a];
              if (typeof(d) == "object") {
                  d = tsfr(d);
              }
              i[a] = d;
          }
      }
      return i;
  }
  i = tsfr(myObject);
  console.log(i)</code></pre>
  </div>
  </div>
  </p>