JavaScript and Its Functions

  1. Function Declarations : Function declarations consist of the function keyword, a name of the function, a pair of parenthesis around zero or more parameters and a pair of curly braces. A typical function declaration:
function printMyName(x) {
//expected output: 'Wreet'
const addTen = function(x) { return x + 10};
//expected output : '15'
const doubled = (x) => x*2;
//expected output: '20'
function printNames(...names){
for (name in names){
printNames('abc', 'def', 'ghi');
// expected output: 'abc', 'def', 'ghi'



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Wreet Sarker

Wreet Sarker

Materials and Metallurgical Engineering graduate. Machine learning and Data Science enthusiast.