Explore BrainMass

Explore BrainMass


    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Suppose the Javascript variables greeting and name have been declared as follows:

    var greeting;
    var name;

    (a) Complete the table below to show the values of the variables after each line of the following code has been executed:

    1. greeting = 'Hello';
    2. name = 'Earthling';
    3. greeting = greeting + name;

    after line1: greeting: name
    after line2: greeting: name
    after line3: greeting: name

    (b) Write a line of code to replace line 3 above which will create a greeting 'Hello Earthling!' with a space in between 'Hello' and 'Earthling' and an exclamation mark at the end.

    © BrainMass Inc. brainmass.com October 10, 2019, 2:56 am ad1c9bdddf

    Solution Summary

    The attached file contains the solution to the javascript problem, which is highlighted in blue.