Hacker News new | ask | show | jobs
by jlg23 3702 days ago
>> * Practice: The more you read and write code, the more proficient you'll become, the more intuition you will develop and thus the faster you'll be when skimming over unknown code.

> if (tab.url.toLowerCase().indexOf("https://facebook.com") > -1)

> Should it be clear to me immediately that this means "If the target website is open"? It took me a solid minute just to understand this statement.

In theory you should figure out what the url-property of tab is (e.g. by logging it's value to the console). Then you see it is a string and check the javascript reference for toLowerCase() and indexOf().

When you've gained some experience you'll recognize those two functions immediately and know what they do and just assume that tab.url is a string (and you'll be mad at the original developer if it isn't).