close

How can I loop through enum values for display in radio buttons?

Hello Guys, How are you all? Hope You all Are Fine. Today we are going to learn How can I loop through enum values for display in radio buttons? in javascript. So Here I am Explain to you all the possible methods here.

Without wasting your time, Let’s start This Article.

How can I loop through enum values for display in radio buttons ?

  1. How can I loop through enum values for display in radio buttons ?

    can I loop through enum values for display in radio buttons
    for (let item in MotifIntervention) { if (isNaN(Number(item))) { console.log(item); } }

  2. How can I loop through enum values for display in radio buttons ?

    can I loop through enum values for display in radio buttons
    for (let item in MotifIntervention) { if (isNaN(Number(item))) { console.log(item); } }

Method 1

Two options:

for (let item in MotifIntervention) {
    if (isNaN(Number(item))) {
        console.log(item);
    }
}

Or

Object.keys(MotifIntervention).filter(key => !isNaN(Number(MotifIntervention[key])));

Summery

It’s all About this article. Hope all method helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which method worked for you? Thank You.

Leave a Comment