mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-23 12:03:28 -05:00
1.9 KiB
1.9 KiB
id, title, challengeType, dashedName
| id | title | challengeType | dashedName |
|---|---|---|---|
| 642ddfdea4200e313f80a4b6 | Step 3 | 0 | step-3 |
--description--
Remember that the document object has a .createElement() method which allows you to dynamically create new HTML elements.
In your createLabel function, declare a label variable and assign it a new div element.
--hints--
You should declare a label variable in your createLabel function.
assert.match(code, /const\s+createLabel\s*=\s*(\(\s*name\s*\)|name)\s*=>\s*\{\s*(?:const|let|var)\s+label/);
Your label variable should be declared with const.
assert.match(code, /const\s+createLabel\s*=\s*(\(\s*name\s*\)|name)\s*=>\s*\{\s*const\s+label/);
You should use the .createElement() method of the document object.
assert.match(code, /document\.createElement\(/);
You should pass the string div to the .createElement() method.
assert.match(code, /document\.createElement\(\s*('|"|`)div\1\s*\)/);
You should assign your new div element to label.
assert.match(code, /const\s+label\s*=\s*document\.createElement\(\s*('|"|`)div\1\s*\)/)
--seed--
--seed-contents--
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="./styles.css" />
<title>Functional Programming Spreadsheet</title>
</head>
<body>
<div id="container">
<div></div>
</div>
<script src="./script.js"></script>
</body>
</html>
#container {
display: grid;
grid-template-columns: 50px repeat(10, 200px);
grid-template-rows: repeat(11, 30px);
}
.label {
background-color: lightgray;
text-align: center;
vertical-align: middle;
line-height: 30px;
}
--fcc-editable-region--
window.onload = () => {
const container = document.getElementById("container");
const createLabel = (name) => {
}
}
--fcc-editable-region--