-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Project1 update #36
base: master
Are you sure you want to change the base?
Project1 update #36
Conversation
var submitAnswer = "" | ||
|
||
var country =["vietnam", "china", "italy", "mexico", "india"] | ||
var image = ["url(./assets/img/vietnam.png)","url(./assets/img/china.png)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't you store just the string of the image instead?
Glow
Grow & Things to look out for
|
// console.log(usedIndex) | ||
randomIndex = Math.floor(Math.random()*5) | ||
if (usedIndex.length < 5){ | ||
while (usedIndex.includes(randomIndex)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
incorrect indentation
function shuffleImg() { | ||
// console.log(usedIndex) | ||
randomIndex = Math.floor(Math.random()*5) | ||
if (usedIndex.length < 5){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain the loop more here
timerObj.startTimer() | ||
if (randomIndex === 0) { | ||
$('<input type="text" class="input" placeholder="* * * * * * *">').insertBefore(".submit"); | ||
} else if (randomIndex === 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the randomIndex
variable are for
$('.submit').click(function() { | ||
var $input = $('.input') | ||
submitAnswer = $input.val() | ||
checkAnswer() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't you pass the answer into the checkAnswer
function
|
||
//does submitAnswer match answer | ||
function checkAnswer() { | ||
if(submitAnswer === answer && timerObj.seconds < 5) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we not repeat these all conditions?
Project Workflow: 3 / 5 Glow
Grow
Things to look out for
|
No description provided.