There are both advantages and disadvantages to both of the alterantives when it comes to choosing between using JavaScript that someone else has already written and writing the JavaScript yourself.
Pre-Written
Pros
- You don't need to know JavaScript to use it.
- You know it will work in those browsers it claims to work in.
- You don't need to spend time working out how to get JavaScript to do what you want.
- It is a quick way of learning how to add JavaScript into web pages without first having to learn JavaScript.
Cons
- There may not be a script that does exactly what you want.
- Other people will have the exact same script on their pages.
- The script may not have been properly tested across all modern browsers.
- The script may not be as efficient as it can be.
- If the script doesn't do exactly what you want you may not be allowed to modify it.
Write It Yourself
Pros
- You can make sure the script does exactly what you want.
- You know the script will work everywhere it is supposed to.
- The JavaScript you are using is not a copy of what anyone else is using.
- You can easily adapt the script if you decide you want it to do something different.
Cons
- You have to learn JavaScript in order to be able to write it.
- You need to test your script thoroughly to make sure it does what it is supposed to.
- The script may need to do things you have not yet figured out how to write in JavaScript.
