title: Hide/Remove ContentType from a SP List with JavaScript
body: <p>I am creating a SP List via REST API, and after the list has been created I'm adding a custom ContentType to that list.
  So, my custom ContentType should be a default CT on that List.</p>
  
  <p>I've already tried this but it doesn't work, probably my contentType has to be an object..</p>
  
  <pre><code>let dfd = new $.Deferred();
  let targetUrl = config.App + subsiteTitle;
  let clientContext = new SP.ClientContext(targetUrl);
  
  if (clientContext !== undefined &amp;&amp; clientContext !== null) {
    let web = clientContext.get_web();
    let listCollection = web.get_lists();
    let list = listCollection.getByTitle(listTitle);
    let contentType = list.get_contentTypes().getById('0x01');
    contentType.deleteObject();
  
    clientContext.executeQueryAsync(
      Function.createDelegate(this, function() {
        dfd.resolve(this);
      }),
      Function.createDelegate(this, function(sender, args) {
        console.log('Failed to remove content type ' + args.get_message());
      })
    )
  }
  
  return dfd.promise();
  </code></pre>
  
  <p>Does anyone know how to hide or remove 'Item' ContentType from that List with JavaScript, or to set my custom ContentType as default, doesn't matter if it is via REST API or JSOM?
  Thanks a lot!</p>