I writing JSOM code to get interact with sharepoint 2013 lists and document libraries.Now I have requirement to allow anonymous users to insert the items for SharePoint Lists list.
Can any one help me in knowing how can I use SPSecurity.CodeToRunElevated in JSOM Code
You can not use elevated privileges in Client Object Model. This would open up a huge security hole. You can use elevated privileges on SSOM, where are supposed that the deploy of a page or component has been approved by someone. Instead anyone could execute client code from anywhere and hack a site.
If you need to do this from the browser, look at either a custom application page or a web service that could run on a server where you could properly elevate privileges.
You can refer this link for more information,