Skip to content

Instantly share code, notes, and snippets.

@sunguru98
Created December 27, 2019 07:52
Show Gist options
  • Save sunguru98/e5736cc4402ae73ab48a33d92bdbf67e to your computer and use it in GitHub Desktop.
Save sunguru98/e5736cc4402ae73ab48a33d92bdbf67e to your computer and use it in GitHub Desktop.
Markdium-Functional Programming vs Object Orietned programming in JavaScript
const addIngredients = (...args) => [...args]
const putIntoMould = (ingredients, mouldShape) => ({
shape: mouldShape,
ingredients: [...ingredients]
})
const placeOven = (mould, heat) =>
`Cake is placed in the oven at ${heat} celsius as a ${mould} mould`
const cakeProcess = placeOven(
putIntoMould(
addIngredients('chocolate', 'eggs', 'icingSugar'),
'circle'
),
'290'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment