HTML manupulating using javascript

I am able to get myVariable printed in the p tag as long as it is either a word or a numner. But if i want to print a sentence like this, then it is not getting printed.
What i want to print- Multiplication of 6 and 3 is 318.
THE CODE:
var x=6 ;
var y=3;
var m = x*y ;
var myVariable = (“Multiplication of” , x , “and” , y , “is” , m) ;
document.getElementById(“demo”).innerHTML = myVariable ;

But, this code is only printing 18 which is the m variable instead of printing the entire sentence.

Use console.log("Multiplication of " , x , " and " , y , " is " , m );
to print the entire sentence . Once try this! I hope u got it.

It is solved guys. Line 4 of the js file had to be this:
var Multiplication = "Multiplication of " + x + " " + “and " + y +” "+ "is " + m

2 Likes