Null checks good practice if code will only be ran when object is never null

Published: 11/01/2019
Null checks good practice if code will only be ran when object is never null
Source: SOFTWAREENGINEERING.STACKEXCHANGE.COM

Using a website with Javascript as example. Let's say I have script A which only performs a specific function on page Foo. For example something like sorting elements in a list. Script A is only added to pages that have a list that needs sorted via javascript. In the javascript we access the list with document.querySelector('#list'); now because this script is only added to pages I know have th

Read more
Related news
Comment
FACEBOOK