html.twig: using JavaScript/jQuery

I like to use jQuery in twig templates.
What im trying is to retrieve values from textfields like {{ content.body }}

My first idea was to write script tags in the template “node–yamlform.html.twig”
and assign the values to variables like

var temp = "{{ content.body }}";

But that doesn’t work.
I can’t go out of the script tags to change something.
Is there a way to do that in the template file?

Thanks for your help!

Drupal version: