I need to add some HTML and Javascript code inside a javascript variable to write them later in my .html page
example of what i tried to write in my Javascript page
var footer = "<footer><script>
if(isMobile.any()){
document.write('<a href="twitter:///user?screen_name=twitter">');
} else {
document.write('<a href="https://twitter.com/twitter">');
}</script></footer>";
and the way im writing it in my HTML document
<script>document.write(footer);</script>
but im getting errors inside my javascript page caused by the javascript code inside the variable
sorry i'm new in javascript and thanks in advance