Hi,
Just wondering if anyone knows the Javascript translation of python’s .count function?
In my experiment I have a list of objects which gets added to as the participant selects objects and then I count how many times each object has been added to the list which determines the stimuli I show next.
In Python this work well and the code is:
Begin Experiment:
FriendsList = [ ]
Begin Routine:
if SearchMouse.clicked_name[0] == CorrectArrow:
FriendsList.append(Who)
End Routine:
if FriendsList.count(‘Rabbit’) > 0:
RabOpacity = 1
else:
RabOpacity = 0
However this doesnt translate into JS very well, from reading the crib sheet I have managed to change the .append to .push but I am now stuck on how to translate the .count
Any help would be much appreciated
Elle