Javascript code appears in search results
Since the javascript code is actually part of the node content it would take a bit of work to get it to be ignored.

An easier solution would be to use implement hook_db_rewrite_sql() and excludes from appearing in search results. Here is a great tutorial: Hiding content from Drupal's search system.

That said, there is a module out there that does this, Search Config. However it is marked as obsolete and not being maintained anymore, therefore you might want to think twice before using it.

For the record it does indeed work as designed, and works well! (I use it on my website with no problems).