Interpolating values is helpful if you need to pass a server-side variable to client-side JavaScript (or other languages that require it). When to use interpolating values in JavaScript? Check out the following example: p | If I don’t write the paragraph with tag interpolation, tags like strong strong | and em em | might produce unexpected results. Do you have to interpolate a word in Pug?īy default, however, Pug removes all spaces before and after tags. In the below example, we have to wrap username in quotation marks in order for JavaScript to interpret it as a string Pug will output the content of the variable as-is, so we need to put it in quotation marks for it to be a proper JavaScript string. This is useful for parametrizing JavaScript code that require something from your server. When to use Pug interpolation in JavaScript? ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |