As long as you're providing javascript to somebody else, you're going to run into this problem. The code has to be interpreted, and for this to happen, it needs to be read, in its entirety, by the interpreter.
You need to identify your goal. Is your goal to prevent your friend reading part of the code, or copying the code?
If you're interested in the former, obfuscating or even just uglifying your code might work. The point of obfuscation is to turn readable code into much, much more difficult to decypher code. Somebody with enough time on their hands will still be able to piece things out, however.
If your goal is to prevent somebody from copying the code, you're out of luck overall. Since your interpreter (in this case, the browser) needs the entire code to start interepreting, there is a point in time when all of it is accessible. All it takes is for somebody to get there at the right time...
Since you are writing a browser extension, you may want to look into other means of writing your code. The browser you are targetting may or may not support web assembly (wasm), which would allow you to write the trivial parts of your extension (data entry, validation and the likes) in JS while keeping the core of it written in pure assembly, compiled down from another language (for example, rust). It still is readable by the trained eye, but much more difficult to port back to the original format you wrote it as.