DEV Community

Ayoazeez26
Ayoazeez26

Posted on

My Cry for Help

Hey guys, so I'm on Hackerrank and I decided to take on their 30 days of code challenge and lo and behold, I get stuck on day 1, so so frustrating. I decided to leave it for a while and came back to it after a few weeks but still with no positive results, so this is my cry for help for anyone willing to assist me in passing through day 1. Thank you in anticipation

Top comments (6)

Collapse
 
itsjzt profile image
Saurabh Sharma • Edited

you stucked at the day 1 problem: well you're not alone it took me days to get a prime number check function right.

  • improve your coding skills

    • Learn to write hello world,
    • Then learn to to take names from command line and say hello (name)
Collapse
 
ayoazeez26 profile image
Ayoazeez26

Thanks for this, my day 1 challenge is on data types and I passed the first test case but unable to pass the second.

Collapse
 
itsjzt profile image
Saurabh Sharma • Edited

Actually hackerranks problem are behind a user login, so I cant see the problem without creating an account.

So my recommendation is:

Divide the problem in parts, solve then one by one, make changes to handle edge cases, so you can pass all tests

Thread Thread
 
ayoazeez26 profile image
Ayoazeez26

Thanks for the advice, I really appreciate it

Collapse
 
kdipippo profile image
Kathryn DiPippo

Hello! I was confused by this too when I went to take a look. From what I understand (based on viewing this problem on a YouTube video), this tutorial is teaching you how to use a JavaScript shell? I'm not sure. It's a different flavor of JavaScript than I'm used to seeing used elsewhere.

I believe the trick to getting step 2 to work is to use this handy function: developer.mozilla.org/en-US/docs/M...
An example of how to use this:

var exampleInput;
exampleInput = readline();
console.log("Woah! You just enterred: " + exampleInput);

I copied and pasted the above code into jdoodle.com/execute-spidermonkey-o... and added some text in the Stdin Inputs section, and the correct "Result" showed up at the bottom.

If you get an error with the above code, I've seen other people who are doing this course change the capitalization to be exampleInput = readLine();. I haven't found any reference to this naming outside of what Hackerrank might talk about under the "Tutorial" tab at the top.

Collapse
 
ayoazeez26 profile image
Ayoazeez26

Hi, thanks for reaching out, I really appreciate it, here's the link to my challenge hackerrank.com/challenges/30-data-... it's just basic data types so I don't know why it's not passing the tests