Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 39 additions & 32 deletions variables-naming-conventions-and-top-to-bottom-code-evaluation.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,39 @@
/*

Objective:
In this activity, you will reinforce the skill of creating and using variables
while practicing best practices in variable naming conventions through a hands-on,
interactive coding challenge.

The code snippet below may include:
- Ambiguous or incorrect variable names.
- Missing variables that need to be created.
- Scenarios that require the use of clear and descriptive variable names.

You will:
- Identify Issues: Review the provided code and identify any variable names that:
- Are unclear or too vague (e.g., a, b, c).
- Do not follow best practices (e.g., camelCase, descriptive naming).
- Refactor the Code: Rename the variables and rewrite the program using descriptive names that clearly convey the variable's purpose.
- Enhance the Program: Add at least two additional variables to improve the program’s functionality or clarity.

Things to reflect on:
- Why is it important to use meaningful variable names?
- What are the common pitfalls to avoid when naming variables?
- How do clear variable names benefit team collaboration?

*/

let a = "Alice";
let b = 5;
let c = 20;
let d = a + " bought " + b + " items for $" + c + ".";

console.log(d);
/*

Objective:
In this activity, you will reinforce the skill of creating and using variables
while practicing best practices in variable naming conventions through a hands-on,
interactive coding challenge.

The code snippet below may include:
- Ambiguous or incorrect variable names.
- Missing variables that need to be created.
- Scenarios that require the use of clear and descriptive variable names.

You will:
- Identify Issues: Review the provided code and identify any variable names that:
- Are unclear or too vague (e.g., a, b, c).
- Do not follow best practices (e.g., camelCase, descriptive naming).
- Refactor the Code: Rename the variables and rewrite the program using descriptive names that clearly convey the variable's purpose.
- Enhance the Program: Add at least two additional variables to improve the program’s functionality or clarity.

Things to reflect on:
- Why is it important to use meaningful variable names?
- What are the common pitfalls to avoid when naming variables?
- How do clear variable names benefit team collaboration?

*/
let firstName = "Alice";
let items = 5;
let price = 20;

let shoppingList = firstName + " bought " + items + " items for $" + price + ".";
let totalCost = items*price;
let companyName = "Launch Code"

console.log(shoppingList);

console.log(firstName + " bought " + items + " items at a rate of $" + price + " each for a total cost of " +totalCost + " for " + companyName + " employees.")