Can anyone please explain to me what a literal is exactly | Sololearn: Learn to code for FREE!

0

Can anyone please explain to me what a literal is exactly

I have done multiple searches about it and still they have not been satisfactory to me. Explanations of any kind and length are welcomed and examples too if any. THANK YOU IN ADVANCE

9/17/2021 12:21:30 PM

Philippe Ezekiel

2 Answers

New Answer

+1

Literal value is something that is explicitly (literally) stated. var foo= 5; //assign the literal value 5 to the variable foo. console.log(foo); // print variable foo to console console.log(5); // print the literal value 5 to the console console.log("Hello"); // print the literal string "Hello".

0

Literal is simply a representation of boolean, integer, character, float, double or string data. Example:- int number = 0; Here 0 is the literal representing a integer value.