Hello Friends 👋,

Welcome to Infinitbility.

Today, we are going to learn how to remove curly braces from string in javascript.

To remove curly braces, we will use javascript replace() method and some regex code.

Javascript replace() method also accept regex code to do the operation and we will write regex code to search curly braces global level in the string.

Let’s take an example

let str = "i'm {infinitbility}, and i provide example of {code snipest}";

Now, we have to remove all curly braces from string.

let str = "i'm {infinitbility}, and i provide example of {code snipest}";

str = str.replace(/[{}]/g,'');


JavaScript, remove, braces, example
JavaScript remove braces example

Here, i have use regex to remove curly braces of every ocurance in string.

Thanks for reading…