I found also this answer:
It to ensure that XHTML validation works correctly when you have JavaScript embedded in your page, rather than externally referenced.
XHTML requires that your page strictly conform to XML markup requirements. Since JavaScript may contain characters with special meaning, you must wrap it in CDATA to ensure that validation does not flag it as malformed.
With HTML pages on the web you can just include the required
JavaScript between and tags. When you validate the HTML on your web
page the JavaScript content is considered to be CDATA (character data)
that is therefore ignored by the validator. The same is not true if
you follow the more recent XHTML standards in setting up your web
page. With XHTML the code between the script tags is considered to be
PCDATA (parsed character data) which is therefore processed by the
validator.
Because of this, you can't just include JavaScript between the script tags on your page without 'breaking' your web page (at least as
far as the validator is concerned).