Uncaught TypeError: .indexOf is not a function
<p>I am new to JavaScript and I'm getting an <strong>error</strong> as below.</p>

<blockquote>
  <p>Uncaught TypeError: time.indexOf is not a function</p>
</blockquote>

<p>Gee, I really thought indexOf() really was a function.  Here is a snippet of my code:</p>

<pre><code>    var timeofday = new Date().getHours() + (new Date().getMinutes()) / 60;
    document.getElementById("oset").innerHTML = timeD2C(timeofday);
&lt;/script&gt;


&lt;script&gt;
 function timeD2C(time) { // Converts 11.5 (decimal) to 11:30 (colon)
    var pos = time.indexOf('.');
    var hrs = time.substr(1, pos - 1);
    var min = (time.substr(pos, 2)) * 60;

    if (hrs &gt; 11) {
        hrs = (hrs - 12) + ":" + min + " PM";
    } else {
        hrs += ":" + min + " AM";
    }
    return hrs;
}
&lt;/script&gt;
</code></pre>