+ 1
Just a question.. 😇
Hey guys, anybody knows how we can embed a methodical operant (*, +, /, %, -) inside a string... We know that the syntax #{} gets used for embeding dates inside the string like - - > name = John - - > now we gonna embed it into a string -- - > puts " your name is : #{name} (it's ruby lng) But when i try a arithmetic operand inside a string it doesn't work I.e - - > a = 9 , b=6 , char = * Now it's embeding time-----> puts "the result is : #{a} #{char} #{b}"
2 ответов
+ 1
You can't do that in JavaScript as of now
...but you can try this out
document.write(eval("9*5"))
0
Instead of printing --> the result is 54, it prints---> the result is : 9*5
N here's my point, how i can made a arithmetic operand works inside a string 😇😇😇