Files
freecodecamp--freecodecamp/curriculum/challenges/english/blocks/basic-javascript/56533eb9ac21ba0edf2244a9.md
T
wehub-resource-sync dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:55:53 +08:00

44 lines
751 B
Markdown

---
id: 56533eb9ac21ba0edf2244a9
title: Initializing Variables with the Assignment Operator
challengeType: 1
forumTopicId: 301171
dashedName: initializing-variables-with-the-assignment-operator
---
# --description--
It is common to <dfn>initialize</dfn> a variable to an initial value in the same line as it is declared.
```js
var myVar = 0;
```
Creates a new variable called `myVar` and assigns it an initial value of `0`.
# --instructions--
Define a variable `a` with `var` and initialize it to a value of `9`.
# --hints--
You should initialize `a` to a value of `9`.
```js
assert(/var\s+a\s*=\s*9(\s*;?\s*)$/.test(__helpers.removeJSComments(code)));
```
# --seed--
## --seed-contents--
```js
```
# --solutions--
```js
var a = 9;
```