We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I'm having a bug with the provided code on Javascript (Node.js):
When using a custom input and giving the number 10, the code returns:
/tmp/submission/20230310/12/14/hackerrank-6cdd7f5bdecf1ec8810a6eaa9da773be/code/Solution.js:52
const n = parseInt(readLine().trim(), 10);
^
TypeError: Cannot read properties of undefined (reading 'trim')
at main (/tmp/submission/20230310/12/14/hackerrank-6cdd7f5bdecf1ec8810a6eaa9da773be/code/Solution.js:52:38)
at Socket. (/tmp/submission/20230310/12/14/hackerrank-6cdd7f5bdecf1ec8810a6eaa9da773be/code/Solution.js:18:5)
at Socket.emit (node:events:525:35)
at endReadableNT (node:internal/streams/readable:1359:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Node.js v18.6.0
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Flipping bits
You are viewing a single comment's thread. Return to all comments →
I'm having a bug with the provided code on Javascript (Node.js):
When using a custom input and giving the number 10, the code returns:
/tmp/submission/20230310/12/14/hackerrank-6cdd7f5bdecf1ec8810a6eaa9da773be/code/Solution.js:52 const n = parseInt(readLine().trim(), 10); ^ TypeError: Cannot read properties of undefined (reading 'trim') at main (/tmp/submission/20230310/12/14/hackerrank-6cdd7f5bdecf1ec8810a6eaa9da773be/code/Solution.js:52:38) at Socket. (/tmp/submission/20230310/12/14/hackerrank-6cdd7f5bdecf1ec8810a6eaa9da773be/code/Solution.js:18:5) at Socket.emit (node:events:525:35) at endReadableNT (node:internal/streams/readable:1359:12) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) Node.js v18.6.0