How would you write out a logarithm base 2 in HTML? In other words, what tags would you use for the formatting? |
|
HTML actually provides a tag – called the subscript tag to make the base 2 formatting of a logarithm easy to display (or any other formatting requiring a subscript). Below we show what the HTML would look like if we wanted to write out log base 2 of 1000.
Using the subscript tag for logarithms in HTMLThis is how you would write out the log base 2 of 1000 in HTML:
log<sub>2</sub> 1000 The result of using the <sub> tag:
log2 1000 Success! Pretty easy – although if asked this question in an interview, it’s something you would either know or not know. |
Subscribe to our newsletter for more free interview questions.
Follow @programmerintvwVaroon Sahgal, Author of ProgrammerInterviewon

