Lesson 10: Understanding Functions

Lesson Overview

In this lesson, we will learn about functions in JavaScript. Functions are reusable blocks of code that perform a specific task.

Graphical Preview

Function Preview

Code Example


function greet(name) {
    return 'Hello, ' + name + '!';
}
console.log(greet('World'));
            

Lesson 10: Understanding Functions

Lesson Overview

In this lesson, we will learn about functions in JavaScript. Functions are reusable blocks of code that perform a specific task.

Graphical Preview

Function Preview

Code Example


function greet(name) {
    return 'Hello, ' + name + '!';
}
console.log(greet('World'));
            
`; const blob = new Blob([htmlContent], { type: 'text/html' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = 'lesson10.html'; a.click(); URL.revokeObjectURL(url); }; document.getElementById('download-js').onclick = function() { const jsContent = `function greet(name) { return 'Hello, ' + name + '!'; } console.log(greet('World'));`; const blob = new Blob([jsContent], { type: 'application/javascript' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = 'lesson10.js'; a.click(); URL.revokeObjectURL(url); };