JSFiddle - React, Tailwind, and code Playground

Change class name on click in jQuery

by Faisal Pathan

JavaScript

var tempArr = [];
var tempArrValues = [];

var main = ["Shopid|System.Int32","OrderId|undefined", "CustomerId|undefined", "LoyaltyType|undefined", "OrderAmount|undefined", "LoyaltyAmount|undefined", "CreatedDate|undefined"];

var sub = "OrderId,CustomerId,LoyaltyType,OrderAmount,LoyaltyAmount,CreatedDate";

console.clear();
//console.log(sub.split(','));

for(var i = 0;i < main.length; i++){
tempArr.push(main[i].split('|')[0]);
 //tempArrValues.push([main[i].split('|')[0],main[i].split('|')[1]])
  tempArrValues.push({name: main[i].split('|')[0],  value:  main[i].split('|')[1]});
}

 

console.log(tempArrValues);
//console.log(tempArr.filter(function(n){ return sub.indexOf(n)>-1?false:n;}));
console.log(tempArrValues.filter(x => x.name == "Shopid").map(el => el.value));