JSFiddle - React, Tailwind, and code Playground

javascript tutorial 3

by Ryan Brown

JavaScript

//Quick prompt to set name prompt automatically to name then alerts the assigned variable. 
/*
var name = prompt("Whats your first name?");

alert("You've entered " + name + " as your first name.");

led to adding two numbers function recall. i took mine to the next level above the tutorial video and have caught a bug. the numbers add as characters 1+1=11 not 2. I've tried declaring as Int and using parseInt to no avail. will have to come back to this one. 


*/
var ptext ="enter the second number to be added"

function get(first, second) {
var first = prompt(ptext);
var second = prompt(ptext);
var sum =(first + second);
alert(sum)

}

function add(first, second) {

return first + second


}


get();
get();



//for some reason the result is adding the input as strings. this may be because of the