Converting C# Enums to JavaScript

In one of my projects, I needed some enums defined in C# to also be usable in my JavaScript code. After some quick research on the internet, I came up with a simple and easy extension method to convert C# enums to JavaScript. Here it is.

Let’s get started with an example enum and suppose we want to be able to also use it with JavaScript.