Javascript not showing in IE

i have this script its a counter it shows on all browsers except internet explorer

`<span id="views_jav_cal">
                          
		  <script>
var myFloat = ( {AUCTION_VIEWS} / 2 ) ;
var myTrunc = Math.trunc( myFloat );
         document.write(myTrunc+ "");
            </script>
                     </span>`

what am i doing wrong here? thank you

What does the console show?

There are several questions.

  • Why is AUCTION_VIEWS in uppercase?
  • Where is the value of AUCTION_VIEWS coming from?
  • Why is AUCTION_VIEWS inside of curly brackets for an object?
  • Why is that which seems to be an object, being divided as if it were a number?
  • Why is an empty string being added?

Good code should not result in any of the above questions.

3 Likes

it shows numbers but doesnt show on internet browser

no worries, sorted out

Care to enlighten the class?

this <script> var myFloat = 5.8; var myTrunc = Math.trunc( myFloat ); document.write(myTrunc+ " "); </script>

does display on IE i dont know why

but this does


<script type="text/javascript"> 
    var round =Math.round(5.8); 
    document.write("Number after rounding : " + round);  
</script> 

http://kangax.github.io/compat-table/es6/#test-Math.trunc

IE does not support the “.trunc()” math function.

1 Like

yh , ie is one hell of a setback, anyway i tried another code n thats ok

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.