Skip to content

Raul-Gamero/JavaScript-Fundamentals-Loops-Functions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 

Repository files navigation

JavaScript Practice – Loops & Functions (Intermediate)

📌 Overview

This repository contains intermediate JavaScript homework focused on:

  • Loops and Iteration
  • Functions

The exercises are designed to help students practice iteration logic, function structure, and basic algorithms using plain JavaScript.

⚠️ No array methods are allowed.


🎯 Learning Objectives

By completing this assignment, students will be able to:

  • Write reusable functions
  • Use loops to process data
  • Iterate over arrays and strings
  • Build simple algorithms step by step
  • Improve logical thinking using JavaScript fundamentals

🛠️ Technical Constraints

  • JavaScript (ES6)
  • Run using Node.js
  • No array methods (map, filter, reduce, forEach)
  • Allowed:
    • functions
    • loops (for, while)
    • variables and operators
    • basic conditionals (if)

📂 Project Structure

📦 js-loops-functions-intermediate
 ┣ 📜 app.js
 ┣ 📜 README.md

▶️ How to Run

node app.js

🧪 Exercises

1️⃣ Array Length

Create a function that:

  • Receives an array
  • Returns the number of elements in the array

2️⃣ Print Elements with Index

Create a function that:

  • Receives an array
  • Prints each element with its index

3️⃣ Sum of Numbers

Create a function that:

  • Receives an array of numbers
  • Uses a loop to calculate the sum
  • Returns the result

4️⃣ Find the Largest Number

Create a function that:

  • Receives an array of numbers
  • Finds and returns the largest number

5️⃣ Reverse an Array

Create a function that:

  • Receives an array
  • Returns a new array in reverse order
  • Do not use array methods

6️⃣ Count a Value

Create a function that:

  • Receives an array and a value
  • Counts how many times the value appears
  • Returns the count

7️⃣ String Loop

Create a function that:

  • Receives a string
  • Prints each character one by one using a loop

8️⃣ Pattern Printing

Create a function that:

  • Receives a number n
  • Prints the following pattern:

For n = 4:

*
**
***
****

📚 Rules

❌ No array methods
✅ Loops and functions only
✅ Clean and readable code
✅ Comments are encouraged


🚀 Bonus (Optional)

  • Solve the exercises using while instead of for
  • Add multiple test cases
  • Try to reuse functions where possible

🧠 Author

JavaScript homework for intermediate students.

About

This repository contains **advanced JavaScript homework** focused strictly on: - Loops and Iteration - Functions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors