Sie erzählte ihm einen Witz, den er jedoch nicht lustig fand.

Could you also say “dennoch” here instead of “jedoch” or would that not work?

It wouldn’t work but its hard to explain since all possible translations transport the meaning of dennoch and jedoch only based on context. Both words can be used synonymously, occasionally. However (very rudimentally explained), dennoch implies resistance and focuses on the result whereas jedoch focuses more on the course of the event and the relation between the actions/circumstances.
Additionally, in the (isolated) sentence above, dennoch doesn’t work because you’d need an explanation for his lack of amusement. With jedoch the focus is clearly on the joke and the unfolding events, with dennoch you’d need more context as it usually implies the end of such course of events and emphasises the result.

These are sentences where only dennoch works and respective variants with jedoch:

‘‘Er hat es sehr gewollt, dennoch - es klappte nicht.’’ - ‘‘Er hat es sehr gewollt, musste jedoch eingestehen, dass es nicht klappte.’’

‘‘Die Sonne scheint, es regnet nicht, ich habe dennoch schlechte Laune.’’ - ‘‘Er meinte die Sonne scheine, jedoch hatte er schlechte Laune.’’

‘‘Der Wahlkampf war hart, der Kandidat hat alles versucht, dennoch war das Ergebnis schlecht.’’ - ‘‘Der hart gekämpfter Wahlkampf konnte das Ergebnis jedoch nicht mehr verändern.’’

‘‘Es gibt Zeugen, aber dennoch haben wir keine Aussage’’ - ‘‘Es gibt Zeugen, sie verweigern jedoch die Aussage’’


It’s tricky. You can oftentimes translate both of them as “however”.
However, “dennoch” conveys a sense of spite, i.e. “in spite of this”. The same as “trotzdem”. This doesn’t work in this example. You would ask “in spite of what?”.
“Jedoch” can most of the time be replaced by “aber”, i.e. a simple “but”. So this works here.