Skip to content
Open
Show file tree
Hide file tree
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
10 changes: 5 additions & 5 deletions 1-js-basics/1-data-types/assignment.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Data Types Practice

## Instructions

Imagine you are building a shopping cart. Write some documentation on the data types that you would need to complete your shopping experience. How did you arrive at your choices?
- Strings: To store text-based information such as product names, categories, and user details.
- Numbers:To handle all quantities, prices, totals, and IDs.
- Boolean:To represent true/false conditions in the cart.
- Arrays:To store lists of related items, such as products in the cart.
- Objects:To represent structured data like a single product, user, or order.
25 changes: 20 additions & 5 deletions 1-js-basics/2-functions-methods/assignment.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
# Fun with Functions
# Challenge
- method is something that belong to an object or a class. It is also defined within a class defination.
while function is something that can be defined any where and used anywhere. A method can only be used to manipulate or something related to it to a class or its objects
# assignment
```
function funct1(a){
console.log(a);
}
```
- or it can be written in the following way

## Instructions
```
function funct2(a){
return a;
}
```
- here is the function with defualt and normal parameters

Create different functions, both functions that return something and functions that don't return anything.

See if you can create a function that has a mix of parameters and parameters with default values.
```
function funct3(a=2,b){
console.log(a+b);
}
37 changes: 16 additions & 21 deletions 1-js-basics/3-making-decisions/assignment.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,4 @@
# Operators

## Instructions

Play around with operators. Here's a suggestion for a program you can implement:

You have a set of students from two different grading systems.

### First grading system

One grading system is defined as grades being from 1-5 where 3 and above means you pass the course.

### Second grading system

The other grade system has the following grades `A, A-, B, B-, C, C-` where `A` is the top grade and `C` is the lowest passing grade.

### The task

Given the following array `allStudents` representing all students and their grades, construct a new array `studentsWhoPass` containing all students who pass.

> TIP, use a for-loop and if...else and comparison operators:

```javascript
let allStudents = [
'A',
Expand All @@ -31,4 +10,20 @@ let allStudents = [
]

let studentsWhoPass = [];
for (let i = 0; i < allStudents.length; i++) {
  let grade = allStudents[i];
  if (typeof grade === "number") {
  if (grade >= 3) {
  studentsWhoPass.push(grade);
  }
  }

  else if (typeof grade === "string") {
  if (grade === "A" || grade === "A-" || grade === "B" || 
  grade === "B-" || grade === "C" || grade === "C-") {
  studentsWhoPass.push(grade);
  }
  }
}
console.log("Passing Students:", studentsWhoPass);
```
11 changes: 7 additions & 4 deletions 1-js-basics/4-arrays-loops/assignment.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Loop an Array

## Instructions
```
for(let i=0;i≤20;i++){
if(i%3 == 0){
console.log(i);
}
}
```

Create a program that lists every 3rd number between 1-20 and prints it to the console.

> TIP: use a for-loop and modify the iteration-expression