Class 05
Class 05: Function
Function
A function is a block of code that performs a specific task or a set of related tasks. Functions are used to organize and modularize code, making it easier to manage and understand.
What I learn
Declaration:
function myFunction() { // Code goes here }Parameters:
function addNumbers(num1, num2) { return num1 + num2; }Return Value: Functions can return a value using the
returnstatement. This value can be used elsewhere in the program.Function Call: To execute a function, you need to call it by using its name followed by parentheses. myFunction();
Create Function with condition x
function counterClockWise
function ClockWise
Create Function with condition y
function counterClockWise
function ClockWise