Super new to coding of any kind. Can someone explain what is means to ‘nest?’
1 Like
What lesson is this quesiton relating to? Please post a link. Thanks.
Nesting
In HTML nesting is when one container wraps another.
<div>
<div>
</div>
</div>
The inner container is nested in the outer one.
In program code, nesting is when one construct wraps another…
for (...) {
if ( ...) {
for ( ... ) {
# code
}
}
}
The code is nested in a for loop nested in an if statement nested in an outer for loop.
In both HTML and JavaScript we indicate nesting by using indentation. This is strictly for the reader’s sake and has no bearing on how the markup will render or the code will run.
2 Likes