The data or the value is termed as a literal in JavaScript. Thus, the following are literals:
3.14 500 true 'Srishti'
On the other hand,
var pi; pi = 3.14;
is a combination of a literal and a variable where pi is a variable which stores the literal 3.14.
In JavaScript, remember that the variables are declared using the var keyword. Although you can write code in any way you like as long as it is syntactically correct, it is always suggested that you should follow certain guidelines. The most commonly followed guideline is by Google, and you can read about it here.
All the lines of JavaScript code should end with a semicolon as it marks the end of a statement. You can read more about the rule for inserting a semicolon in JavaScript here.
Instead of declaring a variable on one line and assigning a value to it on the other line, you can also declare as well as initialize a variable on the same line as follows:
var pi = 3.14;