---
title: "Discussion on \"Tricky Javascript Code Snippets Asked In the Interview\" | Hashnode"
description: "Discussion on \"Tricky Javascript Code Snippets Asked In the Interview\". In this article, we will see some of the most famous interview code snippets that are asked to check your knowledge about Javascript concepts.\nLet's get started.\nPredict the output of the below code:\nconst user = {\n  name: 'Raj',\n  location: {\n    ci..."
url: "https://hashnode.com/posts/tricky-javascript-code-snippets-asked-in-the-interview-1/6088f41c586b183dbcfff7cb"
---

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

Discussion

# [Tricky Javascript Code Snippets Asked In the Interview](https://blog.yogeshchavan.dev/tricky-javascript-code-snippets-asked-in-the-interview-1?utm_source=hashnode&utm_medium=feed)

In this article, we will see some of the most famous interview code snippets that are asked to check your knowledge about Javascript concepts. Let's get started. Predict the output of the below code: const user = { name: 'Raj', location: { ci...

Apr 28, 2021 · 4 min read · blog.yogeshchavan.dev  
Read the article

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

## Written by

[Yogesh Chavan](https://hashnode.com/@myogeshchavan97)

@myogeshchavan97 · India

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

Full Stack Developer | Freelancer | JavaScript | React | Nodejs. https://yogeshchavan.dev/. Book 1:1 @ hiretheauthor.com/myogeshchavan97

Full Stack Developer | Freelancer | JavaScript | React | Nodejs. Loves sharing knowledge through technical articles. Dev.to: https://dev.to/myogeshchavan97 https://linktr.ee/myogeshchavan97

## Responses 2

Markdown supported · ⌘↵ to post

[kishore kumar](https://hashnode.com/@kch)

[Apr 28, 2021](https://hashnode.com/posts/tricky-javascript-code-snippets-asked-in-the-interview-1/6088f41c586b183dbcfff7cb/comment/60898d3f72387b583d1497de)

Yet again , Thanks for such a great article yogesh ... May i know how it is treated as no reassignment of number in this case .... as number is declared with const ... Thanks :)

```
const number = 1;

const result = (function (number) {
  delete number;
  return number;
})(10);
```

[Yogesh Chavan](https://hashnode.com/@myogeshchavan97)

[Apr 28, 2021](https://hashnode.com/posts/tricky-javascript-code-snippets-asked-in-the-interview-1/6088f41c586b183dbcfff7cb/comment/60898d3f72387b583d1497de#reply-608996581bb72c5818620133)

[kishore kumar](https://hashnode.com/@kch) `const` is considered as block scoped.

We can declare a `const` variable with the same name in different blocks. Declaring a function creates a separate block scope so there is no reassignment error

[kishore kumar](https://hashnode.com/@kch)

[Apr 29, 2021](https://hashnode.com/posts/tricky-javascript-code-snippets-asked-in-the-interview-1/6088f41c586b183dbcfff7cb/comment/60898d3f72387b583d1497de#reply-608a1f5772387b583d14a061)

[Yogesh Chavan](https://hashnode.com/@myogeshchavan97)

ahh makes sense ... Thanks yogesh for your kind exp :)

[Kieran Roberts](https://hashnode.com/@kieran6roberts)

[Apr 28, 2021](https://hashnode.com/posts/tricky-javascript-code-snippets-asked-in-the-interview-1/6088f41c586b183dbcfff7cb/comment/6089294c72387b583d148efe)

Nice article as usual [Yogesh Chavan](https://hashnode.com/@myogeshchavan97). I love these little test snippets which I'm now starting to get better at solving since working on interview prep.

[Yogesh Chavan](https://hashnode.com/@myogeshchavan97)

[Apr 28, 2021](https://hashnode.com/posts/tricky-javascript-code-snippets-asked-in-the-interview-1/6088f41c586b183dbcfff7cb/comment/6089294c72387b583d148efe#reply-60892a3472387b583d148f23)

Thank you so much [Kieran Roberts](https://hashnode.com/@kieran6roberts) and all the best for your interview 👍
