---
title: "Restrictions imposed by strict mode on the usage of reserved keywords and variable names."  
description: "Restrictions imposed by strict mode on the usage of reserved keywords and variable names."  
author: "Sandra Emily"  
published: 2023-10-08  
updated: 2023-10-09  
canonical: https://www.mindstick.com/forum/160065/restrictions-imposed-by-strict-mode-on-the-usage-of-reserved-keywords-and-variable-names  
category: "javascript"  
tags: ["javascript", "strict mode"]  
reading_time: 3 minutes  

---

# Restrictions imposed by strict mode on the usage of reserved keywords and variable names.

[Restrictions](https://www.mindstick.com/news/2343/a-handbook-for-social-media-parental-restrictions) imposed by [strict mode](https://www.mindstick.com/forum/160061/what-is-javascript-strict-mode-and-why-is-it-used) on the [usage](https://www.mindstick.com/forum/155707/what-is-the-usage-of-asp-dot-net-configuration-file) of reserved [keywords](https://www.mindstick.com/articles/12899/how-to-spot-if-you-re-optimizing-for-the-wrong-keywords) and [variable](https://www.mindstick.com/articles/1807/objective-c-data-types-variables-object-creation) names.

## Replies

### Reply by Aryan Kumar

[Strict](https://yourviews.mindstick.com/view/81367/usa-imposes-strict-ban-on-syria) [mode](https://yourviews.mindstick.com/view/81372/us-congress-should-go-in-remote-mode-for-proper-functioning) in JavaScript imposes several restrictions on the usage of reserved keywords and variable names to help developers write cleaner and more reliable code. Here are some of the key restrictions imposed by strict mode:

## Reserved Keywords as Variables:

- In strict mode, using reserved keywords (e.g., **let**, **class**, **function**) as variable names is not allowed.

```plaintext
"use strict";
let let = 10; // Error: Unexpected keyword 'let'
```

## Reserved Keywords as Function Parameters:

- You cannot use reserved keywords as function parameter names.

```plaintext
"use strict";
function function(x, class) { // Error: Unexpected keyword 'class'
  // ...
}
```

## Reserved Keywords as Property Names:

- Using reserved keywords as property names in object literals is not allowed.

```plaintext
"use strict";
const obj = {
  class: "MyClass" // Error: Unexpected keyword 'class'
};
```

## arguments and eval:

- In strict mode, you cannot assign values to **arguments** or **eval** or use them as variable names.

```plaintext
"use strict";
eval = 10;      // Error: Assignment to a reserved variable name 'eval'
var arguments = 42; // Error: Assignment to a reserved variable name 'arguments'
```

## Octal Numeric Literals:

- Octal literals (e.g., numbers with leading zeros like **0123**) are not allowed in strict mode.

```plaintext
"use strict";
const octalNumber = 0123; // Error: Octal literals are not allowed in strict mode
```

## Duplicate Parameter Names:

- Strict mode prohibits duplicate parameter names in function declarations.

```plaintext
"use strict";
function duplicateParam(x, x) { // Error: Duplicate parameter name not allowed in this context
  // ...
}
```

## Global Object this:

- In strict mode, the global object (**this**) inside a function called in the global context is **undefined**, rather than referring to the global object itself (e.g., **window** in browsers).

```plaintext
"use strict";
function getGlobalThis() {
  return this;
}

console.log(getGlobalThis()); // undefined
```

## Assignment to Undeclared Variables:

- In strict mode, assigning a value to an undeclared variable (one that hasn't been declared with **var**, **let**, or **const**) is not allowed.

```plaintext
"use strict";
undeclaredVar = 42; // Error: Assignment to an undeclared variable
```

Strict mode helps catch common coding mistakes and promotes better coding practices by making JavaScript more strict and less forgiving of certain types of errors. It's recommended to use strict mode in your JavaScript code to ensure cleaner, safer, and more predictable behavior. You can enable strict mode globally by including **"use strict";** at the beginning of your script or function.


---

Original Source: https://www.mindstick.com/forum/160065/restrictions-imposed-by-strict-mode-on-the-usage-of-reserved-keywords-and-variable-names

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
