Python to JS translation: list.count(object)

I have manged to solve my issue!
Posting the solution incase anyone else encounters this problem:

Using list.includes(object) in JS I can get it to search for whether my list contains the object.

Python code: FriendsList.append(Who) --> JS code: FriendsList.push(Who)
Python code: if FriendsList.count(‘Rabbit’) > 0: --> JS code: if FriendsList.includes(‘Rabbit’) == true

I know this isnt doing exactly the same thing, but it works just fine for what I need.

1 Like