ok here is my example plugin code with comments explaining what I would like.
this is the popup.js
So does anybody know how to call this script to work correctly in wordpress plugin?
You need to specify when the load should happen, try this.
Also, there are errors in your JS, but I have seen the correct version in some answers, hope this helps
Update : There is a hook called wp_enqueue_scripts, as mentioned by @brasofilo which should be used in lieu of init for loading scripts.