---
title: "Discussion on \"Function in JavaScript\" | Hashnode"
description: "Discussion on \"Function in JavaScript\". Why we use function?\nThe main objective of function is to avoid the repeatation of code.\nExample: If we have to perform different operations on two variables we write code as follows:\nlet a=25\nlet b=5\nconsole.log(a + b)\nconsole.log(a - b)\nconsole.log..."
url: "https://hashnode.com/posts/function-in-javascript/62052498b6c216065a35dc1b"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Function in JavaScript](https://vasudhawankhade.hashnode.dev/function-in-javascript?utm_source=hashnode&utm_medium=feed)

Why we use function? The main objective of function is to avoid the repeatation of code. Example: If we have to perform different operations on two variables we write code as follows: let a=25 let b=5 console.log(a + b) console.log(a - b) console.log...

Feb 10, 2022 · 3 min read · vasudhawankhade.hashnode.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#functions](https://hashnode.com/tag/functions)

## Written by

[Vasudha Wankhade](https://hashnode.com/@ElectriGirl)

@ElectriGirl

  
[View profile](https://hashnode.com/@ElectriGirl)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
