When does 2+2=5? When 2 is 2.49.
A resource for web developers a code snippet library with step by step tutorials.

a resource for web developers...

       

Search Amazon

JavaScript: Maths tutorial code snippet 3.

 

Up Up to JavaScript: Maths overview page

 

 

Working with strings: conversion using 'parseFloat()', 'parseInt()' and 'Number()'.

Examples of use of above with strings: '42.50', '42.50text' and 'text'.

Introducing 'typeof()' which returns the type of data that has been passed to it. Using 'isNaN()' on the data type.

Experiment with using 'minus 0' technique on a string to convert to a number.

 





Output view



Back to top

 

Bookmark and Share

 

Copyright © 2006-2012 justfigures.co.uk