Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
69dfab0
Completed first task
Jul 15, 2025
edd7a32
Moving on from Second task: JS beginner task took too long will come …
Jul 22, 2025
37ac66a
functions getGreeting and ageOneYear done
Jul 28, 2025
6c12332
finished make Object and getPropertyValue
Jul 28, 2025
6bf1074
Completed functions deleteProperty and addName using the method Objec…
Jul 28, 2025
80496f1
Finished function returnErrorIfFalsy and getKeys
Jul 29, 2025
e26acd0
finished function makeArrayOfItem and makeArrayOfItems
Jul 29, 2025
09c2476
finished functions hasItem and getItemAtIndex
Jul 30, 2025
a611c88
finished functions insertItemAtIndex and replaceItemAtIndex as well a…
Jul 30, 2025
77542a2
finished function deleteItemAtIndex keep runing into runing errors wi…
Jul 31, 2025
083cd85
Finished functions getType, isNumber and toNumber
Jul 31, 2025
f43bf1a
Completed functions isStringNumber, add, addStrings, addStringsOrNumb…
Oct 1, 2025
d37edd2
Function countIf completed
Oct 7, 2025
163d43b
Function filterStringsWithCommas completed
Oct 31, 2025
18cd42d
function splitStringByCommas completed
Oct 31, 2025
a8f930b
moved on to task 4 to learn React. will get back to jsKata (stopped o…
Nov 4, 2025
c8e746e
React task started, created dog component
Nov 4, 2025
dba7944
Subtitles Implemented for react task
Nov 5, 2025
5f11970
Sucessfully added photo to all components
Nov 5, 2025
ca79732
More dogs ( + pictures ) added!
Nov 6, 2025
50de1a5
Doglist implemented, not tested
Nov 6, 2025
36f88f1
Array made and passed, unfortunately there is a runtime error
Nov 6, 2025
68277d8
Lol fix, was passing the whole object instead of it's elements into t…
Nov 6, 2025
ff72c75
First Project started
Nov 10, 2025
9fa2a69
First Component Rendered
Nov 10, 2025
50725b8
css tailwind configured, first working text implemented
Nov 10, 2025
67236b6
Images Implemented
Nov 14, 2025
c38b2f9
Text and Image Formatting introduced. BulletPoints added. I'm going t…
Nov 14, 2025
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
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"editor.detectIndentation": false,
"editor.insertSpaces": true,
"editor.tabSize": 2,
"editor.codeActionsOnSave": { "source.fixAll.eslint": true },
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"editor.bracketPairColorization.enabled": true,
"editor.guides.bracketPairs": "active",
"[javascript]": {
Expand Down
137 changes: 120 additions & 17 deletions 3-JSKata/1-objects-and-arrays/kata.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,84 @@

// getGreeting should return a string containing
// 'Hello ' and the contents of `name`
function getGreeting(name) {}
function getGreeting(name) {
return 'Hello ' + name
}

// ageOneYear should return a new object with an `age` property 1 greater
// than the `age` property of `obj`
function ageOneYear(obj) {}
function ageOneYear(obj) {
const newObj = {
...obj,
age: obj.age + 1,
}

return newObj
}

// makeObject should return an object that looks like this:
// (but using the arguments passed to the function)
// {
// key: value
// }
function makeObject(key, value) {}
function makeObject(key, value) {
const newObj = {}

newObj[key] = value

return newObj
}

// getPropertyValue should return the value of the
// property contained in the `key` of `obj`
function getPropertyValue(obj, key) {}
function getPropertyValue(obj, key) {
return obj[key]
}

// addName should return a copy of `obj` with the addition of a `name`
// property that has the value of the `name` argument
// Tip: consider the object literal spread syntax
function addName(obj, name) {}
function addName(obj, name) {
const objectAddName = Object.assign({}, obj)

objectAddName.name = name

return objectAddName
}

// deleteProperty should return a new copy of `obj` without the property name
// that matches the `key` parameter
// Tip: consider JavaScript's `delete` operator
function deleteProperty(obj, key) {}
function deleteProperty(obj, key) {
const objectDeleteProperty = Object.assign({}, obj)

delete objectDeleteProperty[key]

return objectDeleteProperty
}

// returnErrorIfFalsy should return a JavaScript Error object with message:
// 'Oh no, an error!'
// if val evaluates to false
// Tip: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error
function returnErrorIfFalsy(val) {}
function returnErrorIfFalsy(val) {
if (!val) {
return new Error('Oh no, an error!')
}
return val
}

// keys should return an array of the object's property names (keys)
// For example, given { foo: 1, bar: 2 } it would return ['foo', 'bar']
function getKeys(obj) {}
function getKeys(obj) {
return Object.keys(obj)
}

// getValues should return an array of the object's own values
// For example, given { foo: 1, bar: 2 } it would return [1, 2]
function getValues(obj) {}
function getValues(obj) {
return Object.values(obj)
}

/**
* Arrays
Expand All @@ -52,36 +90,101 @@ function getValues(obj) {}
// makeArrayOfItem should return an array that is `length` long, made up of
// `item`. For example, makeArrayOfItem('foo', 2) would return:
// ['foo', 'foo']
function makeArrayOfItem(item, length) {}
function makeArrayOfItem(item, length) {
const myArray = []

for (let i = 0; i < length; i++) {
myArray.push(item)
}

return myArray
}

// makeArrayOfItems should return an array containing all arguments passed to it
// Tip: consider JavaScript's Rest parameters
function makeArrayOfItems() {}
function makeArrayOfItems(...item) {
return item // Using the rest Parameter, it captures everything and stores it in an array
}

// hasItem should return true if `item` is present in `arr` at least once,
// otherwise it should return false.
// Tip: there is an array function that makes this straightforward
function hasItem(arr, item) {}
function hasItem(arr, item) {
for (let i = 0; i < arr.length; i++) {
if (arr[i] == item) {
return true
}
}
return false
}

// getItemAtIndex should return arr[idx] but only if that index exists:
// if it doesn't, return a JavaScript Error object.
function getItemAtIndex(arr, idx) {}
function getItemAtIndex(arr, idx) {
for (let i = 0; i < arr.length; i++) {
if (i == idx) {
return arr[i]
}
}
return new Error()
}

// replaceItemAtIndex should return a copy of `arr` with
// the element at `idx` replaced with `item`
// Tip: consider the array literal spread syntax
function replaceItemAtIndex(arr, idx, item) {}
function replaceItemAtIndex(arr, idx, item) {
const tempArray = []

for (let i = 0; i < arr.length; i++) {
tempArray[i] = arr[i]
if (arr[i] == arr[idx]) {
tempArray[i] = item
}
}

return tempArray
}
Comment on lines +135 to +146
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix index comparison logic.

The function incorrectly compares array values instead of indices, which could replace multiple elements with the same value.

 function replaceItemAtIndex(arr, idx, item) {
-  const tempArray = []
-
-  for (let i = 0; i < arr.length; i++) {
-    tempArray[i] = arr[i]
-    if (arr[i] == arr[idx]) {
-      tempArray[i] = item
-    }
-  }
-
-  return tempArray
+  const newArr = [...arr]
+  if (idx >= 0 && idx < arr.length) {
+    newArr[idx] = item
+  }
+  return newArr
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function replaceItemAtIndex(arr, idx, item) {
const tempArray = []
for (let i = 0; i < arr.length; i++) {
tempArray[i] = arr[i]
if (arr[i] == arr[idx]) {
tempArray[i] = item
}
}
return tempArray
}
function replaceItemAtIndex(arr, idx, item) {
const newArr = [...arr]
if (idx >= 0 && idx < arr.length) {
newArr[idx] = item
}
return newArr
}
🤖 Prompt for AI Agents
In 3-JSKata/1-objects-and-arrays/kata.js around lines 135 to 146, the function
replaceItemAtIndex incorrectly compares array values instead of indices in the
loop, causing multiple replacements if values match. Fix this by changing the
condition to compare the current index i with the target index idx, so only the
element at idx is replaced with item.


// insertItemAtIndex should return a copy of `arr` with `item` inserted at
// `idx` without overwriting any array values (the array should get longer)
function insertItemAtIndex(arr, item, idx) {}
function insertItemAtIndex(arr, item, idx) {
const tempArray = []

for (let i = 0; i < arr.length; i++) {
tempArray[i] = arr[i]
if (i == idx) {
tempArray.splice(i, 0, item)
}
}

return tempArray
}
Comment on lines +150 to +161
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix array insertion logic.

The current implementation modifies the array during iteration and doesn't correctly handle insertion. Use array methods for a cleaner solution:

 function insertItemAtIndex(arr, item, idx) {
-  const tempArray = []
-
-  for (let i = 0; i < arr.length; i++) {
-    tempArray[i] = arr[i]
-    if (i == idx) {
-      tempArray.splice(i, 0, item)
-    }
-  }
-
-  return tempArray
+  return [...arr.slice(0, idx), item, ...arr.slice(idx)]
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function insertItemAtIndex(arr, item, idx) {
const tempArray = []
for (let i = 0; i < arr.length; i++) {
tempArray[i] = arr[i]
if (i == idx) {
tempArray.splice(i, 0, item)
}
}
return tempArray
}
function insertItemAtIndex(arr, item, idx) {
return [...arr.slice(0, idx), item, ...arr.slice(idx)]
}
🤖 Prompt for AI Agents
In 3-JSKata/1-objects-and-arrays/kata.js lines 150 to 161, the current
insertItemAtIndex function incorrectly modifies the array during iteration and
does not insert the item properly. To fix this, avoid modifying the array inside
the loop; instead, create a new array by slicing the original array up to the
index, then add the new item, and finally concatenate the remaining elements
from the original array after the index. Return this new array as the result.


// deleteItemAtIndex should return a copy of `arr` without
// the element at `idx` (the array should get shorter).
function deleteItemAtIndex(arr, idx) {}
function deleteItemAtIndex(arr, idx) {
const tempArray = []

for (let i = 0; i < arr.length; i++) {
tempArray[i] = arr[i]
if (i == idx) {
tempArray.splice(idx, 1)
}
}

return tempArray
}
Comment on lines +165 to +176
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Simplify deletion logic.

The current approach modifies the array during iteration. Use a cleaner solution:

 function deleteItemAtIndex(arr, idx) {
-  const tempArray = []
-
-  for (let i = 0; i < arr.length; i++) {
-    tempArray[i] = arr[i]
-    if (i == idx) {
-      tempArray.splice(idx, 1)
-    }
-  }
-
-  return tempArray
+  return arr.filter((_, index) => index !== idx)
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function deleteItemAtIndex(arr, idx) {
const tempArray = []
for (let i = 0; i < arr.length; i++) {
tempArray[i] = arr[i]
if (i == idx) {
tempArray.splice(idx, 1)
}
}
return tempArray
}
function deleteItemAtIndex(arr, idx) {
return arr.filter((_, index) => index !== idx)
}
🤖 Prompt for AI Agents
In 3-JSKata/1-objects-and-arrays/kata.js around lines 165 to 176, the function
deleteItemAtIndex modifies the array while iterating, which is inefficient and
error-prone. Instead, create a new array by filtering out the element at the
given index or use array slicing to exclude the item at idx. This will simplify
the logic and avoid modifying the array during iteration.


// deleteItem should return an array with every instance of `item` removed
function deleteItem(arr, item) {}
function deleteItem(arr, item) {
for (let i = 0; i < arr.length; i++) {
if (arr[i] == item) {
arr.splice(i, 0, item)
}
}

return arr
}
Comment on lines +179 to +187
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Critical: Function mutates input and uses incorrect splice parameters.

The function has two major issues:

  1. It mutates the original array instead of returning a new one
  2. splice(i, 0, item) inserts the item instead of removing it

Apply this fix:

 function deleteItem(arr, item) {
-  for (let i = 0; i < arr.length; i++) {
-    if (arr[i] == item) {
-      arr.splice(i, 0, item)
-    }
-  }
-
-  return arr
+  return arr.filter(el => el !== item)
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function deleteItem(arr, item) {
for (let i = 0; i < arr.length; i++) {
if (arr[i] == item) {
arr.splice(i, 0, item)
}
}
return arr
}
function deleteItem(arr, item) {
return arr.filter(el => el !== item)
}
🤖 Prompt for AI Agents
In 3-JSKata/1-objects-and-arrays/kata.js around lines 179 to 187, the deleteItem
function incorrectly mutates the input array and uses splice with parameters
that insert the item instead of removing it. To fix this, avoid mutating the
original array by creating and returning a new array that excludes the specified
item, and remove the incorrect splice call that inserts the item. Use a method
like filter to return a new array without the item.


// zipObject should return an object built from two arrays
// For example, given ['foo', 'bar'] and [1, 2] it would return
Expand Down
103 changes: 92 additions & 11 deletions 3-JSKata/2-strings-and-numbers/utilities.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,105 @@
function getType(thing) {}
function getType(thing) {
return typeof thing
}

function isNumber(thing) {}
function isNumber(thing) {
if (typeof thing === 'number') {
return true
} else {
return false
}
}

function toNumber(str) {}
function toNumber(str) {
return Number(str)
}

function isStringNumber(str) {}
function isStringNumber(str) {
if (isNaN(str)) {
return false
} else {
return true
}
}

function add(a, b) {}
function add(a, b) {
return a + b
}

function addStrings(a, b) {}
function addStrings(a, b) {
let num1 = parseInt(a)
let num2 = parseInt(b)
let num3 = num1 + num2

function addStringsOrNumbers(a, b) {}
return String(num3)
}

function addStringsOrNumbers(a, b) {
let num1 = parseInt(a)
let num2 = parseInt(b)
let num3 = num1 + num2

function isEmail(str) {}
if (isNumber(a) && isNumber(b)) {
return num3
} else {
return String(num3)
}
}

function countIf(array, fn) {}
function isEmail(str) {
for (let i = 0; i < str.length; i++) {
if (
str[i] === '@' &&
str[i] === '.' &&
str[i] === 'c' &&
str[i] === 'o' &&
str[i] === 'm'
) {
return true
} else {
return false
}
}
}

function filterStringsWithCommas(str) {}
function countIf(array, fn) {
let count = 0

function splitStringByCommas(str) {}
for (let i = 0; i < array.length; i++) {
if (fn(array[i]) != false) {
count += 1
}
}
return count
}

function filterStringsWithCommas(str) {
let count = 0
for (let i = 0; i < str.length; i++) {
if (str[i] == ',') {
count += 1
}
}

if (count > 0) {
return true
} else {
return false
}
}

function splitStringByCommas(str) {
let index
for (let i = 0; i < str.length; i++) {
if (str[i] == ',') {
index = str[i]
}
}

newStr = str.split(index)

return newStr
}
Comment on lines +91 to +102
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Fix missing variable declaration and simplify implementation.

Critical issues:

  1. Line 99: newStr is missing a declaration (let, const, or var), creating an implicit global variable
  2. The logic is flawed: index stores the comma character (,), not its position, and gets overwritten on each iteration
  3. The implementation is unnecessarily complex for a simple string split operation

Apply this diff to fix:

 function splitStringByCommas(str) {
-  let index
-  for (let i = 0; i < str.length; i++) {
-    if (str[i] == ',') {
-      index = str[i]
-    }
-  }
-
-  newStr = str.split(index)
-
-  return newStr
+  return str.split(',')
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function splitStringByCommas(str) {
let index
for (let i = 0; i < str.length; i++) {
if (str[i] == ',') {
index = str[i]
}
}
newStr = str.split(index)
return newStr
}
function splitStringByCommas(str) {
return str.split(',')
}
🤖 Prompt for AI Agents
In 3-JSKata/2-strings-and-numbers/utilities.js around lines 91 to 102, the
function uses an undeclared variable newStr, misuses index (stores a comma char
not position), and overcomplicates splitting; replace the loop with a direct
split and declare locals: simply return str.split(',') (or assign const parts =
str.split(',') and return parts) to avoid implicit globals and incorrect logic.


module.exports = {
getType,
Expand Down
4 changes: 4 additions & 0 deletions 3-JSKata/4-types/functions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function callsFunction(func) {
let i = func()
return i
}
Loading