Recently in a job interview I was asked the following questions. I was
able to answer the first one, but the 2nd one still baffles me. I'm
curious if anyone can provide a little insite:
1) What two chars have to be escaped when performing a
document.write()?
I answered that quotes, both single and double need to be escaped when
they are supposed to be part of the output of a document.write
statement.
He seemed happy with that response.
2) What is the main thing that has to be done when performing a
document.write() in a script block?
I had no clue. The question seems pretty vague... I couldn't and still
can't think of what "has" to be done, besides the obvious of including
it inside a <script> tag, or adding content to what will be outputted
in the document.write.
Any ideas?