How to insert list items using JavaScript Object Model in SP

I am trying to insert list item’s value through JavaScript object model in SP. When I call set_item(‘fieldname’,’Title’), it throw error “c.set_item is not a function“. How to successfully Insert a ListItem? here is my code:

var itemCreateInfo = new SP.ListItemCreationInformation(); this.oListItem = oList.addItem(itemCreateInfo);  oListItem.set_item('Title', 'My New Item!'); oListItem.update();