Javascript not showing in IE

#1

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

#2

What does the console show?

#3

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
#4

it shows numbers but doesnt show on internet browser

#5

no worries, sorted out

#6

Care to enlighten the class?

#7

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> 

#8

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

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

1 Like
#9

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