JSFiddle - React, Tailwind, and code Playground
HTML
<div id="modal-body">
<span2>
</span2>
</div>
JavaScript
var curr_op = {" ":" ","Tangential-S1":"Tangential-S1","Diagonal-Q1":"Diagonal-Q1","addnew":"Add New"};
function getPropsAsString(curr_op) {
var props = [];
for (prop in curr_op) {
var value = curr_op[prop];
// filter them by some logic
if (value === " " || value === "Add New")
continue; // skip it
props.push(prop);
}
// do whatever you want with the properties
props.sort(); // maybe you want to sort them?
return props.join(", ");
}
$('#modal-body span2').html( getPropsAsString(curr_op) );