Copy and paste the following script.
<script language="ecmascript" type="text/ecmascript">
var contentTypeCollection;
function createContentType() {
var clientContext = new SP.ClientContext.get_current();
if (clientContext != undefined && clientContext != null) {
var web = clientContext.get_web();
this.contentTypeCollection = web.get_contentTypes();
var newContentType = new SP.ContentTypeCreationInformation();
newContentType.set_name('Custom Content Type');
newContentType.set_description('My custom content type');
this.contentTypeCollection.add(newContentType);
clientContext.load(this.contentTypeCollection);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}
}
function onQuerySucceeded() {
alert("Content Type created successfully")
}
function onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}</script>
<input id="btnCreateContentType" onclick="createContentType()" type="button" value="Create Content Type" />