Computer Science, asked by rizwanatabasuum4311, 1 year ago

In how many ways functions can be defined in javascript w3schools

Answers

Answered by jai696
1

\huge{\mathtt{{\blue{\boxed{\tt{\pink{\orange{A}\purple{n}\blue{s}\red{w}\green{e}\pink{r᭄}}}}}}}}

4 ways

\huge\blue{\mid{\fbox{\tt{Explanation}}\mid}}

A Function as a Statement

function add(num1, num2) {

return num1 + num2

}

A Function as an Expression

const add = function a(num1, num2) {

return num1 + num2

}

An Arrow Function

const add = (num1, num2) => num1 + num2

Using Function Constructor

var add = Function('num1', 'num2', 'return num1 + num2')

\large\mathsf\color{lightgreen}useful?\: \color{white}\longrightarrow\: \color{orange}brainliest!

Similar questions