You have two options. You need to choose between them, then do your research to understand each one. The two options are mutually exclusive, so once you choose one, you should ignore the other, otherwise you'll confuse yourself :-)
- Use Google Apps Script. This is server-side Javascript and is decribed here https://developers.google.com/apps-script/ and the Google Drive aspect is described here https://developers.google.com/apps-script/reference/drive/
- Use the Drive SDK. Since you said Javascript, this will be using client-side Javascript. The top level doc is https://developers.google.com/drive/, plus you will need to understand OAuth https://developers.google.com/accounts/docs/OAuth2UserAgent
Remember, as you are doing your research, make sure that you are only reading about option 1 or option 2.