Check out example codes for "how to take multiple inputs in one propmt". It will help you in understanding the concepts better.

Code Example 1

const inputs = prompt("Enter your inputs separated by a tilde ~").split("~");

console.log(inputs);

Learn ReactJs, React Native from akashmittal.com