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
24 changes: 24 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [


{
"type": "node",
"request": "launch",
"name": "Mocha Tests",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"${workspaceFolder}/tests.js"
],
"internalConsoleOptions": "openOnSessionStart",
"skipFiles": [
"<node_internals>/**",
"${workspaceFolder}/node_modules/**/*"
]
}
]
}
36 changes: 17 additions & 19 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,40 @@
function stringIncludes(haystack, needle) {
for (let i = 0; i < haystack.length; i++) {
if (haystack.slice(i, needle.length) === needle) {
return true
if (haystack.slice(i, i + needle.length) === needle) {
return true;
}
}

return false
return false;
}

function countLetter(haystack, needle) {
let count = 0

while (haystack.length) {
if (haystack.shift() === needle) {
count++
let count = 0;
for (let i = 0; i < haystack.length; i++) {
if (haystack.slice(i, i + needle.length) === needle) {
count++;
}
}

return count
return count;
}

function camelCase(sentence) {
const arr = sentence.split(' ')
const arr = sentence.split(" ");

for (let i = 0; i < arr.length; i++) {
arr[i] = arr[i].toLowerCase()
for (let i = 1; i < arr.length; i++) {
arr[0] = arr[0].toLowerCase();
arr[i] = arr[i].toLowerCase();
const letters = arr[i].split("");
letters[0] = letters[0].toUpperCase();

const letters = arr[i].split('')
letters[0] = letters[0].toUpperCase()

arr[i] = letters.join('')
arr[i] = letters.join("");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Semicolons and double quotes? Make sure your linter is working, these should have been flagged.

}

return arr.join('')
return arr.join("");
}

module.exports = {
stringIncludes,
countLetter,
camelCase,
}
};
Loading