-
Notifications
You must be signed in to change notification settings - Fork 0
Problem based learning: check if variables are defined #3723
Marie-Louise edited this page Feb 8, 2019
·
2 revisions
#3723
it was necessary to check if the variable is defined before the code block can be run. I left this out and it broke stage, so here was my solution. I will use a small part of the object to demonstrate.
before
if (window.innerWidth < (Settings.gridBreakpoint.xs + 50) && pager.children.length > 7)
{ item.classList.add('responsive-pagination');
}
after
if (pager && typeof item !== 'undefined') {
if (window.innerWidth < (Settings.gridBreakpoint.xs + 50) && pager.children.length > 7) {
} item.classList.add('responsive-pagination');
}