+ 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}"

30th Aug 2017, 4:57 AM
UbuUunTu✔️
UbuUunTu✔️ - avatar
2 odpowiedzi
+ 1
You can't do that in JavaScript as of now ...but you can try this out document.write(eval("9*5"))
30th Aug 2017, 7:18 AM
Nomeh Uchenna Gabriel
Nomeh Uchenna Gabriel - avatar
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 😇😇😇
30th Aug 2017, 4:58 AM
UbuUunTu✔️
UbuUunTu✔️ - avatar