This script runs if you visit a webpage containing it. The webpage might be a hacked legitimate page, or a malicious page set up by a hacker.
This script 'likes' Facebook content (like a page or a post) without your knowledge or consent. 'Liking' content on Facebook means that your friends in the network see this action, leading them to possibly view the content and also get infected.
This script has been found used by malicious websites to gather a lot of page visits for profit.