Instead of filtering quotes, I would truncate the quote string after it gets displayed, but before setting the Twitter link. Looks like a job for
String.slice(). Actually, one of the algorithm challenges has you doing something very much like this. As far as your code, I think it’s organized pretty well and readable. I’d say you could ditch
window.open() in favor of a normal
<a> link with the
target="_blank" attribute as pop-up blockers can prevent
window.open() from working, but there’s nothing wrong with the way you did it (in fact, you could pass it some more parameters to change the size of the window and its location when it pops-up). What makes me raise an eyebrow is that
currentAuthor are defined without the
var keyword, which means the variables are on the global scope. This is the only reason you’re able to set the Twitter link like you are. I would actually prefer the code you have on line 21, myself, and then add that
var keyword to the variables. This will make truncating a string for the URL much easier, too.
Nice job, overall!