+ 1

Access Function from Different Code

Let's say I created a javascript code function with 500 lines. I want tgat function for my new project, but copy pasting the function will cause lag in my SoloLearn editor. Is it possible for me to access that function in a new SoloLearn project? ======================================== Example: SoloLearnServer/web/[user_id]/HugeFunctionCode: JS Code- function hugeCode(a, b, c) { //500 lines later var finalResult a+b+c; //just sample, I don't want to in fact just sum them return finalResult; } SoloLearnServer/web/[user_id]/SmallProgram: HTML Code- <script id="bigcode" src="SoloLearnServer/web/[user_id]/HugeFunctionCode" type="javascript></script> JS Code- var bigScript = document.getElementById("bigcode"); console.log(bigScript.hugeCode(1, 2, 3)); ========================================= Is this possible in SoloLearn? If so, how do I go about doing it? [I haven't learnt php or jquery yet, but if that's needed, I'll appreciate it if you can put the sample code to access the script please]

5th Jul 2018, 3:37 AM
Andre Daniel
Andre Daniel - avatar
1 Respuesta
+ 4
Press save as and save it as a new code.
5th Jul 2018, 6:54 AM
Toni Isotalo
Toni Isotalo - avatar