@@ -885,11 +885,11 @@ What about an IIF that does have external references, is that closure?
885
885
886
886
``` js
887
887
function printLabels (labels ) {
888
- var list = document .getElementByID (" labelsList" );
888
+ var list = document .getElementById (" labelsList" );
889
889
890
890
labels .forEach (
891
891
function renderLabel (label ){
892
- var li = document .createELement (" li" );
892
+ var li = document .createElement (" li" );
893
893
li .innerText = label;
894
894
list .appendChild (li);
895
895
}
@@ -909,7 +909,7 @@ To understand why, consider this alternative form of `printLabels(..)`:
909
909
910
910
``` js
911
911
function printLabels (labels ) {
912
- var list = document .getElementByID (" labelsList" );
912
+ var list = document .getElementById (" labelsList" );
913
913
914
914
for (let label of labels) {
915
915
// just a normal function call in its own
@@ -920,7 +920,7 @@ function printLabels(labels) {
920
920
// **************
921
921
922
922
function renderLabel (label ) {
923
- var li = document .createELement (" li" );
923
+ var li = document .createElement (" li" );
924
924
li .innerText = label;
925
925
list .appendChild (li);
926
926
}
@@ -937,7 +937,7 @@ By the way, Chapter 7 briefly mentioned partial application and currying (which
937
937
938
938
``` js
939
939
function printLabels (labels ) {
940
- var list = document .getElementByID (" labelsList" );
940
+ var list = document .getElementById (" labelsList" );
941
941
var renderLabel = renderTo (list);
942
942
943
943
// definitely closure this time!
@@ -947,7 +947,7 @@ function printLabels(labels) {
947
947
948
948
function renderTo (list ) {
949
949
return function createLabel (label ){
950
- var li = document .createELement (" li" );
950
+ var li = document .createElement (" li" );
951
951
li .innerText = label;
952
952
list .appendChild (li);
953
953
};
0 commit comments