Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Basics (Retired) Making Decisions with Conditional Statements Booleans

need help

hey guys I have been forced to put this last course off due to my daughter being born this past Thursday , and just got home from the hospital about an hour ago.. wasn't I am going to have to speed through these videos so that I can meet my deadline @ midnight eastern time! help please if anyone sees me asking for help w/ JavaScript basics course! I am going to go back and fully study this course once i submit by midnight! thanks in advance

script.js
if ( parseInt(guess)  ) {
    alert('This is true');
} else {
    alert('This is false');
}
index.html
<!DOCTYPE HTML>
<html>
<head>
  <meta charset="UTF-8">
  <title>JavaScript Basics</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>

7 Answers

Hey Colby. CONGRATULATIONS! Which video? Can I see the entire script?

Java script Basics, I am on the last two tracks.

the coding is working for me. if guess is "10" I get true if guess is "ten" I get false what is your objective. If I know the exact video I can pull up my workspace and help better.

Thanks Teresa. I am not going to be able to meet my deadline.

I'm sorry I couldn't be more help. But I'm so happy for you as well. How many videos did you have left?

If I send you all of the videos that I need help w/, could you assist me? I would completely understand if you didn’t want to.

I can do my best. I'm a little new to this. Let's try it.Perhaps under the circumstances they would give you more time.

Ok all of them are in the JavaScript Basics course.

Video: Storing and tracking info w/ variables. Objectives
• using string methods

Video: working w/ numbers Objectives • Using Math Methods

Video: Making Decisions w/ conditional states Objectives • Using comparison operators •booleans • a basic if statement • add a final else clause •super conditiona challenge

Video: creating reusable code w/ functions All of the objectives on this one.

For some reason I'm just getting this comment. I'm trying to do a synopsis for each, but I can see we won't do in time. But hey, if they go by CA time? I think they might cut you some slack. How can I best help you? I could be available by phone. Might be faster.

Hey Colby, I guess we didn't make the midnight deadline. But I think they will probably give you more time. So I'll watch for you in Community. I could send more info, but would probably not cover all you need to pass tests. Hope to see you in Community.

functions

/*

Terminology as related to functions:

Function: A function is a section of your java script that only processes when you "call" it from the main part of your java script. You can call it (run it) as many times as you need to.

function functionName ( parameter, parameter )

You can pass information to the function to process. That information is called an "argument".

Argument: The information (data) that is passed to a function. Depending on which information (directive) is passed, the function will do one thing or another.

The argument is stored in a variable called a parameter. The parameter sits in the parenthesis at the end of the function name.

Parameter: The variable (container) for an argument.

("passing an argument to a function") "so you can pass a piece of information, called an argument, to a function. The function stores that argument in a parameter and uses that argument within the function."

Note that "Say Hi" is an argument in the following "alert" function: alert("Say Hi");

This is an example of a function that you send 2 numbers to, the function adds them, then it returns the sum to the statement that called it.

function addTwoNumbers ( number1, number2 ) { var sumOfNumbers = number1 + number2; return sumOfNumbers; }

the function name is addTwoNumbers the 2 parameters are "number1" and "number2" the numbers you pass to the function (arguments) are stored by the function in the parameters number1 & number2

You call the function by using it's name in a statement in the main part of the program. For example.

var sumOfNumbers = addTwoNumbers(10, 20);

The function will return the sum, 30, to the variable sumOfNumbers.

See the getRandomNumber function below.

*/

//javascript.js

function getRandomNumber( upper ) { var randomNumber = Math.floor( Math.random() * upper ) + 1; return randomNumber; }

console.log( getRandomNumber(6)); //function will generate a random number <= 6 console.log( getRandomNumber(100)); //function will generate a random number <= 100 console.log( getRandomNumber(2)); //function will generate a random number <= 2

This practice shows -- prompting for string variables, -- "concatenating" them together (splicing them together) -- discovering the length of the string -- alerting as to how long the string is

// 1. Attach this file -- practice.js -- to the index.html file using a <script> tag

// 2. In this JavaScript file, add a prompt dialog to capture input from the user and store it in a variable

// 3. Add a second a prompt dialog to capture input from the user and store it in a second variable

// 4. Create a third variable and which combines an uppercase version values in the two other variables separated by a space. For example, if the first two variables contain "sally" and "forth", this third variable should contain the string value "SALLY FORTH"

// 5. Create a fourth variable to store a number. The number should be the total number of characters in the third variable.

// 6. Add an alert dialog box that says "The string '[insert value of third variable here]' is X number of characters long." For example, if the third variable contained the string "SALLY FORTH" then the alert dialog should says "The string 'SALLY FORTH' is 11 characters long."

var Sign = prompt("What is your astrological sign?"); var Name = prompt("What is your first name?"); var SignName = Sign.toUpperCase() + " " + Name.toUpperCase(); var NameLength = SignName.length;

alert("The string \"" + SignName + "\" is " + NameLength + " characters long.");