CSOM Get List Fields

Posted here for self-reference. This is how to get all fields within a list using client object model. The output is logged to the javascript console. Very handy when you’re trying to get internal/hidden field names without having to go to PowerShell or deploy custom code. In my case I needed some of the hidden attributes within picture libraries.