Functions in output | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 4

Functions in output

Lets say i define a function in the code in javscript and the body has an attribute:contenteditable and i write a function in the body that was defined in the javascript code, how can i make the function written in the body do the same as the one in tje javascript code; if my question wasnt clear, please tell me

9th Aug 2020, 3:45 PM
Goke Ekundayo
Goke Ekundayo - avatar
9 Antworten
+ 21
Gekoda, good question! First of all — to execute a function print you need to call it somewhere in your code. Otherwise it won't work 😥. https://code.sololearn.com/W9rVJk28tqBe/?ref=app
10th Aug 2020, 6:59 PM
🇺🇦 Vitya 🇺🇦
🇺🇦 Vitya 🇺🇦 - avatar
+ 20
Check out my example. It runs twice 👍. https://code.sololearn.com/W9rVJk28tqBe/?ref=app
10th Aug 2020, 7:02 PM
🇺🇦 Vitya 🇺🇦
🇺🇦 Vitya 🇺🇦 - avatar
+ 4
Can you share the code? Because it isn't really clear to as what you want to do ,if you write a function in body it should work the same as well !
9th Aug 2020, 3:53 PM
Abhay
Abhay - avatar
10th Aug 2020, 6:35 PM
Goke Ekundayo
Goke Ekundayo - avatar
10th Aug 2020, 6:36 PM
Goke Ekundayo
Goke Ekundayo - avatar
+ 3
But how can i make it run as if the text in the body is the JavaScript code😥
10th Aug 2020, 7:00 PM
Goke Ekundayo
Goke Ekundayo - avatar
10th Aug 2020, 7:27 PM
xym
xym - avatar
+ 2
Gekoda I didn't get your question, but let me still ask you, did you want to manipulate the text inside the body with JavaScript. Pls just share an example of what you want to achieve.
11th Aug 2020, 2:46 AM
ugochukwu Joseph
ugochukwu Joseph - avatar
0
Gekoda. [[[[[[I N A C T I V E]]]]]] check this code maybe is what you want. How it works click the button to output the value inside the function with the parameter inside print() function you created, keep clicking on the button to add print the same value as many as possible you can equally edit the output. But if it's not what you need pls be more specific. https://code.sololearn.com/W8Ms3bCNqmXy/?ref=app
20th Aug 2020, 9:22 AM
ugochukwu Joseph
ugochukwu Joseph - avatar