match-game | A drag-and-drop match game | Widget library
kandi X-RAY | match-game Summary
kandi X-RAY | match-game Summary
A drag-and-drop match game
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of match-game
match-game Key Features
match-game Examples and Code Snippets
Community Discussions
Trending Discussions on match-game
QUESTION
As part of a school project we are creating an application where users can match with each other if they play the same game. When you click on matchButton a random user that plays the game you have chosen will show up on the page. You can choose to like that user or continue hitting the matchButton to randomize another user.
Now we want to make sure that a user you have already liked won't be randomized and therefore not be rendered on the page.
The users that have been liked are saved in an array called match in the database, for each user. The users that play the same game are saved in an array called numOfMatches. So it is numOfMatches that we use to randomize a user.
I think I have to loop through numOfMatches and the match array in the database to see if the user in numOfMatches is already in the database. If so, I need to remove the user from numOfMatches so that it is not included in Math.random code.
I tried with this code in the last function in this post, but I am having a problem with understanding how to reach the elements in the match array in the users object and how to use splice (and in which function I should place the code since we use callbacks which I think is a bit tricky):
...ANSWER
Answered 2020-Apr-01 at 13:05Here is a simple example.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install match-game
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page