From f030bf661045fa75bbfcfabf0cc9c0af2b325744 Mon Sep 17 00:00:00 2001 From: Malhar Soomro <77386938+Malhar-Soomro@users.noreply.github.com> Date: Tue, 19 Oct 2021 01:11:57 +0500 Subject: [PATCH] introduction of arrow function through code --- arrowFunction.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 arrowFunction.js diff --git a/arrowFunction.js b/arrowFunction.js new file mode 100644 index 0000000..5d44a97 --- /dev/null +++ b/arrowFunction.js @@ -0,0 +1,12 @@ +function regular() { + // returning object + return { name: "john" } +} +let returnedValue = regular() +// printing object returned by regular function +console.log(returnedValue); + +// same code written in arrow function +let arrow = () => ({ name: "john" }); +returnedValue = arrow(); +console.log(returnedValue); \ No newline at end of file