Untitled

mail@pastecode.io avatar
unknown
html
2 years ago
1.7 kB
9
Indexable
Never
<html>
    <head></head>
    <body>
        <table class="highlighttable"><tbody><tr><td class="linenos"><div class="linenodiv"><pre>1
            2
            3
            4
            5
            6</pre></div></td><td class="code"><div class="highlight"><pre><span class="o">&lt;</span><span class="nx">script</span><span class="o">&gt;</span>
            <span class="kr">const</span> <span class="nx">fruits</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"Apple"</span><span class="p">,</span> <span class="s2">"Orange"</span><span class="p">,</span> <span class="s2">"Apple"</span><span class="p">,</span> <span class="s2">"Mango"</span><span class="p">];</span>
            <span class="kd">let</span> <span class="nx">position</span> <span class="o">=</span> <span class="nx">fruits</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="s2">"Apple"</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span><span class="p">;</span>
            
            <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="s2">"demo"</span><span class="p">).</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="s2">"Apple is found in position "</span> <span class="o">+</span> <span class="nx">position</span><span class="p">;</span>
            <span class="o">&lt;</span><span class="err">/script&gt;</span>
            </pre></div>
            </td></tr></tbody></table><br>
    </body>
</html>

<style>
    .highlighttable{
        background:gray;
    }
</style>