A slightly less technical version of the answers provided (which are all more correct than this answer) but to allow you to undesrand the displayed output - its all about strings versus numbers - if two elements are numbers and you add them - you will get numerical addition. If you have a number and a string - when you add them the output will be the number followed by the string.
so to look at your examples:
var x = 5 + 2 + 3;
Output: 10
The 5,2 and 3 are all numbers so that the output is what they are all added together
var x = 5 + 2 + "3";
Output: 73
The 5 and 2 are numbers so are added together to give 7, but the "3" is a string so it give the number followed by the string ie 7 followed by 3 or 73
x = "5" + 2 + 3;
Output: 523
The 5 is a string and 2 and 3 are numbers, but are not added to each other but displayed next to each other - 523
var x = 5 + "2" + 3;
Output: 523
The 5 is a number and the "2" is a string and 3 is a number, but are not added to each other but displayed next to each other - 523