Hi everyone! I'm the author of code.mu :)
I'd love to chat with my non-Russian audience. I'm looking for your feedback on the site and the translation quality. Let's chat:)
⊗jsPmFTFTV 226 of 504 menu
◀ ▶

Writing a function to another variable in JavaScript

Let we have our function func:

function func() { console.log('!'); }

Let's copy its source code into the variable test:

function func() { console.log('!'); } let test = func; // now test is the same function as func // Let's check: test(); // shows '!' func(); // shows '!'

Make the function func1 that will return the number 3 via return.

Copy the source code of the function func1 into the variable func2.

Print to the console the sum of the results of the functions func1 and func2.

← →
↑
English▼
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline