These are both usually translated as “jealous” or “envious”.
Avundsjuk is the straightforward kind of envy where someone has something that you wish you had. You usually feels like they’re inferior and that’s why you don’t have the thing. This is probably how you feel if you don’t have the Nintendo Switch yet. Avund is the word for envy (the noun) so it’s fitting that the “straightforward” version is in avundsjuk.
Svartsjuk is usually borne of insecurity that you will lose something that you have. For example, you are svartsjuk if your significant other is chatting with a good-looking person, or your boss is doting on a new employee that threatens your position.