Purchase Solution

Javascript

Not what you're looking for?

Ask Custom Question

The following two programs differ in that one uses parseFloat and the other does not. What will be the output from each program if the user inputs 4 followed by 2?

Give your reasons.

Program 1

var first;
var second;
first = window.prompt('Enter a digit','0');
second = window.prompt('Enter a second
digit','0');
document.write(first + second);

Program 2

var first;
var second;
first = window.prompt('Enter a digit','0');
second = window.prompt('Enter a second
digit','0');

first = parseFloat(first);

second = parseFloat(second);

document.write(first + second);

Purchase this Solution

Solution Summary

The solution provides to the point answer to the problem stated.

Solution Preview

Program 1

The program script will output 42 on the webpage; the program considers ...

Purchase this Solution


Free BrainMass Quizzes
Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Javscript Basics

Quiz on basics of javascript programming language.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

C++ Operators

This quiz tests a student's knowledge about C++ operators.