As a software developer, almost anything you create is your own intellectual property. This means that you own it and thus have control over whether or not others can use it. Similarly, when you use software or code written by other people, you are only doing so with their permission. Licenses are legal tools used to specify who can use software, and how. As a developer, it is critically important that you are aware of licenses and that you follow them properly when using code written by others.
While your first instinct may be to prevent others from using your work, that is often not the best choice. Many software developers and companies choose to allow others to use their code, which is great! Think about some of the tools, libraries, and frameworks that you’ve used throughout your learning. Most, if not all, of these were used legally via open source licenses. Such licenses ensure that developers can share and use code appropriately, making the world of development a better place for everyone!
Read The Legal Side of Open Source. Read sections 1-4. If you’re interested, continue through the end of the article.
Browse choosealicense.com. This site is great tool than can help you determine which license to apply to your project based on how you want to allow others to use it. Have a look and read about some of the licenses that it recommends for various purposes.