So, here is my solution to challenge 2. Also, it is minified just in case scoring is based on the length.
Update: I just minified it further to 357 characters in order to tie with @MrEconomical in length.
Another Update: I just minified it further to 265 characters in order to make mine officially smaller than @MrEconomical 's. (actually 271 since I noticed a bug)