Documentation is great and all, but the real trick is looking up what you're trying to do on https://codesearch.wmcloud.org and finding out how other beings did it! ;3
@theresnotime the same process is often best for writing content, too! If in doubt, I often look at how a Featured/Good quality article does something. (Or for writing documentation, checking a handful of known-good pages)