Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This comment is hidden because it contains spoiler information about the solution
Here the issue is that you have re-declared the your variable again, and you have not added an element to separate the variable from the string in the console.log().
" 'string ' + variableName"
or" 'string', variableName"
.Note that when using the
+
, which is called the concatenate operator and is used to combine strings and other elements, I would advice to leave a space at the end of the string so that the string and the variable are not stuck together when printed.But when using the
,
it automatically leaves a space between the two elements.${The variable would be here}
, it can be declared here or just called in hereI hope that it helps. Keep up the good work.
Cheers. Don't give up. We get to see these type of codes to see what is possible. Just researh it, learn to understand it, and you can use it after as well. You got this.
Very nice answer.
It would have worked if you had changed
console.log()
withreturn
, and place the elements in a function. As the result of your code is not being displayed in the console, but being tested, and thus needs to have the result returned. Keep up the good work.` function evenOrOdd ( number = prompt("Enter a number: ") ) {
if (number % 2 == 0){
} else{
}
}`
I hope that it helps.
Thank you so much for your explanation and the function explaining it. I tested it and it worked with my assumptions in the way your functions explained. I shall look more into bitwise operations as well.
I love those as well. It's so interesting. I always look up what they're about if no one explained them in the replies. It's fun to know that those fancy options exist.
This comment is hidden because it contains spoiler information about the solution
This is just awesome lol. I'm loving it.
Actually x is a string, so it doesn't need to be turn into a string in the context of this challenge. But it would indeed be good practice to set it the way you suggested more realistic cases where people are more likely to set x as a number type. But because this challenge asked for the values of x to be strings, it should be fine. Thank you for your insight, I had missed that out.
I like how different the answers are here. I like how you solved it.
I'm impressed.
I was wondering the same thing and this answer is just awesome. Thank you for taking the time to write all this. I shall definitely pay more attention to the data type when comparing. Thank you for your insight.
I was wondering the same thing and this answer is just awesome. Thank you for taking the time to write all this. I shall definitely pay more attention to the data type when comparing. Thank you for your insight.