I want to know if i write a Google Chrome extension, will anyone be able to use my code?
Every Chrome Extension gives the user the following rights by default:
5.2 You grant to the user a non-exclusive, worldwide, and perpetual license to perform, display, and use the Products and any content contained in, accessed by, or transmitted through the Products in connection with Google Chrome. If you choose, you may include a separate end user license agreement (EULA) in your Product that will govern the user’s rights to the Products in lieu of the previous sentence.
Read the whole agreement here: http://developer.chrome.com/webstore/terms
That doesn't mean that the user has the right to alter and/or distribute your code, but as others have pointed out, they will be able to see your JavaScript if they want to.