Explore the community Forums Lectora Lectora Questions & Answers Drag and Drop – check each drop as it happens Reply To: Drag and Drop – check each drop as it happens

#386370 Score: 0
Profile photo of Math Notermans
Math Notermans
Member
contributor
intermediate
advanced
friend finder
junior moderator
advocate
LUC16 Attendee
LUC16
wise owl
curious george
129 pts
@mnotermans5114

Basically this function is needed for a check how many choices are incorrect.

function count(main_str, sub_str)
{
main_str += ”;
sub_str += ”;if (sub_str.length <= 0)
{
return main_str.length + 1;
}subStr = sub_str.replace(/[.*+?^${}()|[\]\\]/g, ‘\\$&’);
return (main_str.match(new RegExp(subStr, ‘gi’)) || []).length;
}
console.log(count(“1-1,2-(na),3-(na),4-(na),5-(na),6-(na),7-(na),8-(na),9-(na)”, ‘(na)’));

Gonna add that tonight…