These are some simple examples for using Slash Commands in discord.js.
discord.js doesn't have full support for slash commands yet (there's a pr) but you can still use the underlying api and websocket to use them.
Note that discord.js doesn't officially support using client.api, this is basically just a workaround until they fully release support. Do not ask for help with client.api in the discord.js server.
Please read Discord's Slash Command docs since they have actual docs and details for slash commands; the code examples below are just how you can implement it using discord.js.
Note that slash commands won't show in a server unless that server has authorized it with the applications.commands oauth2 scope (not just the bot scope).