JavaScript If/else statement within switch case if/else statement java,if/else statement python,if/else

I'm new to js/programming and just making a simple calculator using prompt. I'm trying to validate that what's been entered are numbers and not strings. I tried this

var operatorType = prompt("Do you want to add, subtract, multiply or divide?").toLowerCase();

switch (operatorType) {
    case 'add':
        var i = prompt("Enter your first number");
        var j = prompt("Enter your second number");
        if (isNaN(i) === false) && (isNaN(j) === false) {
            document.write(i+" plus "+j+" equals "+(i+j));
        } else {
            document.write("You didn't enter two numbers.");
        }
    break;

As well as if (i != 'string') && (j != 'string') but I keep getting "Unexpected token &&". I looked it up and if/else within a case is valid so I'm not sure what I'm doing wrong.

Full code if it helps

var operatorType = prompt("Do you want to add, subtract, multiply or divide?").toLowerCase();

switch (operatorType) {
    case 'add':
        var i = prompt("Enter your first number");
        var j = prompt("Enter your second number");
        if (isNaN(i) === false) && (isNaN(j) === false) {
            document.write(i+" plus "+j+" equals "+(i+j));
        } else {
            document.write("You didn't enter two numbers.");
        }
    break;

    case 'subtract':
        var i = prompt("Enter your first number");
        var j = prompt("Enter your second number");
        document.write(i+" minus "+j+" equals "+(i-j));
    break;

    case 'multiply':
        var i = prompt("Enter your first number");
        var j = prompt("Enter your second number");
        document.write(i+" multiplied by "+j+" equals "+(i*j));
    break;

    case 'divide':
        var i = prompt("Enter your first number");
        var j = prompt("Enter your second number");
        document.write(i+" divided by "+j+" equals "+(i/j));
    break;

    default:
        document.write("Please enter whether you want to add, subtract, multiply or divide.");
    break;
}
Answer:1

I have an AngulaarJS application where users select the day they want to view and it prints on the calendar the day and the next 30 days. The intended functionality needs to be so that when a user ...

I have an AngulaarJS application where users select the day they want to view and it prints on the calendar the day and the next 30 days. The intended functionality needs to be so that when a user ...

  1. how to get current date in angularjs
  2. angularjs add days to current date

I would like to get a list of all the properties, styles, events and methods of an HTML element. Is there a reflection API in the browsers? I'm looking for something like this: var button = new ...

I would like to get a list of all the properties, styles, events and methods of an HTML element. Is there a reflection API in the browsers? I'm looking for something like this: var button = new ...

  1. does javascript run in browser or server
  2. does javascript run in browser

My function is like below. Consider for high performance, how can I avoid to add text in a loop structure in html? Please advise. Thank you so much. function createDiv (array) { var i; var ...

My function is like below. Consider for high performance, how can I avoid to add text in a loop structure in html? Please advise. Thank you so much. function createDiv (array) { var i; var ...

I have an assignment to create a battleship game, with 3x3 - 10x10 grid. My current idea would be to create a grid with a click of a button, or atlest change the current size with a click of a button. ...

I have an assignment to create a battleship game, with 3x3 - 10x10 grid. My current idea would be to create a grid with a click of a button, or atlest change the current size with a click of a button. ...

  1. create specific size file linux
  2. create specific size image
  3. create specific size file windows
  4. create specific size file
  5. create pdf specific size
  6. create a specific size rectangle in photoshop
  7. create list specific size python
  8. create partition specific size diskpart
  9. create dataframe specific size
  10. create file specific size powershell
  11. create vector specific size
  12. word create specific size
  13. create array of specific size python
  14. create array with specific size javascript
  15. create file of specific size mac
  16. create array of specific size matlab
  17. create array of specific size java
  18. create vector of specific size c++
  19. create arraylist of specific size
  20. create matrix with specific size matlab