Please help, can't complete blackjack, step 3


#1

program writes:
Oops, try again. false

Code:
var twoRandomScores = function() {
var score1,score2;
for (i=0;i<1;i++) {
score1=(Math.floor(Math.random()*10+1));
score2=(Math.floor(Math.random()*10+1));
console.log("Сумма карт равна " + (score1+score2));
};
};

 twoRandomScores ();

console shows :
Сумма карт равна 6
2
Сумма карт равна 8

https://www.codecademy.com/ru/courses/javascript-beginner-BXTqc-ru/0/3#


#2

Please post a link to this exercise.


#3

Here it is: https://www.codecademy.com/ru/courses/javascript-beginner-BXTqc-ru/0/3#


#4

It looks like the code checker expects you to return a number for your total score.


#5

Thank you, Cap! But how can i solve this??? Console shows "2" and i don't know how to get rid of it;


#6

Have you learned about return statements yet? You need to add a return statement to your function. It should be the last line of this function because as soon as the return statement is processed the program will return to where the function was called from.


#7

yes Ser! i have little progress, but "2" still appears! How can i get rid of it?

var twoRandomScores = function() {
var score1,score2;
for (i=0;i<1;i++) {
score1=(Math.floor(Math.random()*10+1));
score2=(Math.floor(Math.random()*10+1));
return score1+score2;
};

};

twoRandomScores ();

#8

never mind, thanks for help! i'll continue!


#9

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.