---
title: "Discussion on \"Two Ways to Write a Function: Declarations vs. Expressions in JavaScript\" | Hashnode"
description: "Discussion on \"Two Ways to Write a Function: Declarations vs. Expressions in JavaScript\". They look similar, but the JavaScript engine treats them entirely differently. Learn how functions work under the hood and why hoisting matters."
url: "https://hashnode.com/posts/two-ways-to-write-a-function-declarations-vs-expressions-in-javascript/6a00a7e7e3eebc2e20995a51"
---

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

Discussion

# [Two Ways to Write a Function: Declarations vs. Expressions in JavaScript](https://blog.himanshubalani.com/two-ways-to-write-a-function-declarations-vs-expressions-in-javascript?utm_source=hashnode&utm_medium=feed)

They look similar, but the JavaScript engine treats them entirely differently. Learn how functions work under the hood and why hoisting matters.

May 10 · 5 min read · blog.himanshubalani.com  
Updated May 13  
Read the article

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

## Written by

[Himanshu Balani](https://hashnode.com/@himanshubalani)

@himanshubalani · Nagpur, IN

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

Making Tech Simple and Fun

CS Graduate | Technical Writing | Software development | 50K+ impressions

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
