Posts

Showing posts with the label jive

Jquery check if array 2 use all values array 1

Jquery check if array 2 use all values array 1 i'm trying to check if the array1 use all values of my array2, if false return error message, but my array1.length is not equal to array2.length , i'm searching for hours to know why. Can someone help me? and if the problem does not come from there, anyone can tell me my mistake ? function controlUserInput(inputText, appLang) { const regex = /$[^$]*$/gm; const str = $('#formulaire-preview-textarea').val(); let m; var array = populateVariable(appLang); while ((m = regex.exec(str)) !== null) { // This is necessary to avoid infinite loops with zero-width matches if (m.index === regex.lastIndex) { regex.lastIndex++; } // The result can be accessed through the `m`-variable. m.forEach((match, groupIndex) => { console.log(`Found match, group ${groupIndex}: ${match}`); var isEqual = match.length==array.length; // for (i=0; i<=array.length-1;i++){ if(displayCpt == 4 && is...