3 Type Javascript Function

  1. declaration function (function with name function)
  2. Anonymous function (function without name)
  3. arrow function
function Person(name, age) {  this.name = name;  this.age = age;}function Employee(name, age) {  return name}const varPerson = Person(“ana”, 5)console.log(varPerson)const varEmployee = Employee(“ana”,6)console.log(varEmployee)
console.log(this)console.log(this.Employee(“ana”, 8))
  1. Anonymous function
const employeeName = function(){  return “paul”}console.log(employeeName())
function Teacher(name, age) {  this.name = name;  this.age = age;  this.nameAndAge = function(){      return this.name + “ “ + this.age  }}const objTeacher = new Teacher(“poter”, 50)console.log(objTeacher.nameAndAge())
  1. Arrow function
hello = () => {  return “Hello World!”;}
hello = function() {  return “Hello World!”;}hello = () => {  return “Hello World!”;}




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Vous pensez que c’est une arnaque ou vraiment un touriste perdu?

LeetCode Algorithm Series: Valid Palindrome

04.12.2021 — ONE PUNCH MAN CLOUD.

4 Useful DevTools console methods

Stop using ReactFire in your React-Redux Application — Part 1

Adding a Calendar and Reformatting Datetime in React

[LeetCode] 1. Two Sum

Migrating from sw-precache-webpack-plugin to workbox-webpack-plugin

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
wahyu eko hadi saputro

wahyu eko hadi saputro

i am a reader

More from Medium

Javascript 1O1 series : introduction

JavaScript:- Arrays

Handy Javascript Array Methods

The Difference between Var, Let and Const | JavaScript 01.

Learn Javascript