Why does this Google close line look like this?

Why does this javascript line look like this? I mean, why is there an extra + near the end?

'<script type="text/javascript" src="' + src + '"></' + 'script>' 

Source: http://code.google.com/p/closure-library/source/browse/trunk/closure/goog/base.js#511

+6
source share
1 answer

Because if you have a "</script>" inside the <script> , the browser will think that you have closed the script tag. This is a fairly common way to include text </script> inside a string in <script> tags.

+10
source

Source: https://habr.com/ru/post/906228/


All Articles