From 567909c48a9997c3104788aa96ca787cf99b6c94 Mon Sep 17 00:00:00 2001 From: John Woolbright Date: Tue, 18 Feb 2025 10:43:22 -0600 Subject: [PATCH 1/2] initial commit --- ...tions-and-top-to-bottom-code-evaluation.js | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 variables-naming-conventions-and-top-to-bottom-code-evaluation.js diff --git a/variables-naming-conventions-and-top-to-bottom-code-evaluation.js b/variables-naming-conventions-and-top-to-bottom-code-evaluation.js new file mode 100644 index 0000000..c9d1be4 --- /dev/null +++ b/variables-naming-conventions-and-top-to-bottom-code-evaluation.js @@ -0,0 +1,32 @@ +/* + +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); From d7c7c4139765d622971fbd33c1bb4f1383180393 Mon Sep 17 00:00:00 2001 From: celliott36/software-dev-course-programEnvironment-to-do-list Date: Fri, 27 Mar 2026 15:26:20 -0500 Subject: [PATCH 2/2] committed naming --- ...ventions-and-top-to-bottom-code-evaluation.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/variables-naming-conventions-and-top-to-bottom-code-evaluation.js b/variables-naming-conventions-and-top-to-bottom-code-evaluation.js index c9d1be4..d95b425 100644 --- a/variables-naming-conventions-and-top-to-bottom-code-evaluation.js +++ b/variables-naming-conventions-and-top-to-bottom-code-evaluation.js @@ -24,9 +24,17 @@ Things to reflect on: */ -let a = "Alice"; -let b = 5; -let c = 20; -let d = a + " bought " + b + " items for $" + c + "."; +/*let a = "Alice"; //vague variable name, not using camelCase +let b = 5; //vague variable name, not using camelCase +let c = 20; //vague variable name, not using camelCase +let d = a + " bought " + b + " items for $" + c + "."; //vague variable name, not using camelCase console.log(d); +*/ +let userName = "Alice"; //previously had vague variable name, not using camelCase +let numberOfItems = 5; //previously had vague variable name, not using camelCase +let totalCost = 20; //previously had vague variable name, not using camelCase +let itemsBought = userName + " bought " + numberOfItems + " items for $" + totalCost + "."; //previously had vague variable name, not using camelCase +let programDescription = "This program calculates the total cost of items bought by a user."; //added additional variable to improve program's functionality +console.log(itemsBought); +console.log(programDescription); \ No newline at end of file