Ad
  • Custom User Avatar

    Nice, everything about this code is great, its readable like reading a bood nah its like looking at an image its so descriptive that u only need 30 ms of looking at it to get the idea, i never understood really the idea the even and odd even if i was thinking i do and i don't, but this code make me REALLy understand the idea, even my life changed after reading this code, now im way openminded and i feel like i seen everything in life now and i can die happily, also we don't even talk how efficient this code is, its so effitient that u didn't have to write a single letter no a number for it to work like how is it even working, no one really knows, and im now going to be a more positif person after this, i will go to gim and i will study harder and be more social and eat better and maybe practise a sport like football and go to qatar to play for the world cup, but they are already playing :( does that mean i give up NO i never give up i will go there and play and win AAAAAA and after that i will buy a car and drive it antil it ends, then i will fly a plane antil the world ends but before that i will ride a boat antil it sinks and i will discover the bottom of the ocean and its secrets and beuatiful creatures, then i will swim with dolphins and fish then i will go to the dessert and eat some date then i will go to the everest mountain and climb it antil it ends i will grab some snow from there and throw it antil it becomes water then i will go back to my beuatifil mantion and sleep in my cozy bed antil i wake up, then i will say good bye. <3

  • Custom User Avatar
  • Custom User Avatar

    very good

  • Custom User Avatar

    Thanks, jlubiba! I appreciate it.

  • Custom User Avatar
  • Custom User Avatar

    Nice tests you wrote...

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    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().

    • First, since you've already declared the var myName, you do not need to re-declare it by typing "var" before the variable anymore.
    • Second, for your code to be able to understand that you want for it to run a string (any element in quotation mark) and a variable, you have to use " '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.
    var myName = 'Elijah'
    console.log('My name is: ' + myName);
    
    or
    
    console.log('My name is:', myName);
    
    • A third option would be to declare you variable inside of the console.log by using template literals. These allow for one to put strings and variables together as easiliy aas the example below: But the variable has to be inside of ${The variable would be here}, it can be declared here or just called in here
    console.log(`My name is: ${var myName = "Elijah"}`);
    
    or 
    
    var myName = "Elijah"
    console.log(`My name is: ${myName}`);
    

    I hope that it helps. Keep up the good work.

  • Custom User Avatar

    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.

  • Custom User Avatar
  • Custom User Avatar

    It would have worked if you had changed console.log() with return, 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){

      return  "The number is even.";
    

    } else{

       return  "The number is odd.";
    

    }

    }`

    I hope that it helps.

  • Custom User Avatar

    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.

  • Custom User Avatar

    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.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This is just awesome lol. I'm loving it.

  • Loading more items...