User
Write something
Beginner Coaching Call is happening in 46 hours
Hoisting from today's js interview call
........this is saying copilot: Hoisting with let and const: In summary, while all declarations (including let, const, and var) are hoisted, the behavior differs: - var variables are hoisted with default initialization (value: undefined). - let and const variables are hoisted without initialization, leading to a temporal dead zone where they cannot be accessed before declaration12. - ................................This is from MDN docs: - let declarations can only be accessed after the place of declaration is reached (see temporal dead zone). For this reason, let declarations are commonly regarded as non-hoisted. - (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let) - const declarations can only be accessed after the place of declaration is reached (see temporal dead zone). For this reason, const declarations are commonly regarded as non-hoisted. - (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const)
9
2
New comment May 22
Help study for the interview
Hey guys, I've developed something similar to quizlet to help study for all the interview questions. It leverages openAI's API and let's you type an answer in and it will tell you how to correct your answer if you're a little or a lot off. The repo can be found here: https://github.com/THEjacob1000/study-buddy And to get it working you'd need your own API key from OpenAI located here: https://platform.openai.com/api-keys Once you have one, create a .env file in the root directory and create the variable: `OPENAI_API_KEY=<your api key here>`
6
7
New comment May 15
Help study for the interview
Balls
@Cristian Florea @Basil Gubara got the balls working from the call earlier. Check it out https://codesandbox.io/p/sandbox/balls-lz8mc5?file=%2Fsrc%2FBall.tsx%3A77%2C1 When the isActive flag changes the whole balls array needs to re-render, but when progress is increasing only the effected ball re-renders
3
2
New comment May 14
Find the Longest Increasing or Decreasing Combination in an Array
function longestComb(arr, command){ const result = []; function backtrack(startIndex, currentComb) { console.log('currentComb', currentComb) if (startIndex >= arr.length - 1) { if (currentComb.length >= 3) { result.push(currentComb.slice()); } return; } else { if (currentComb.length >= 3) { result.push(currentComb.slice()); } } for (let i = startIndex; i < arr.length; i++) { if (!currentComb.length) { currentComb.push(arr[i]); backtrack(i + 1, currentComb); currentComb.pop() } else { if (command === '< <' || command === '<<') { if (currentComb.at(-1) < arr[i]) { currentComb.push(arr[i]); backtrack(i + 1, currentComb); currentComb.pop(); } } else if (command === '> >' || command === '>>') { if (currentComb.at(-1) > arr[i]) { currentComb.push(arr[i]) backtrack(i + 1, currentComb); currentComb.pop(); } } } } } backtrack(0, []); if (!result.length) { return result; } console.log(result) const mappedToLength = result.map(el => el.length); const longestLength = Math.max(...mappedToLength); const filteredResult = result.filter(el => el.length === longestLength); return filteredResult.length > 1 ? filteredResult : filteredResult[0]; } let arr = [-1, 3, -34, 18, -55, 60, 118, -64]; let comm = '< <'; console.log('#1', longestComb(arr, comm)); // [-1, 3, 18, 60, 118] arr = [-1, 3, -34, 18, -55, 60, 118, -64]; comm = '> >'; console.log('#2', longestComb(arr, comm)) // [3, -34, -55, -64]]); arr = [-26, 26, -36, 17, 12, 12, -10, -21]; comm = '< <'; console.log('#3', longestComb(arr, comm)) // [] arr = [ 36, 26, -26, -40, 12, 27, -56, 34, -55 ] comm = '> >'; console.log('#4', longestComb(arr, comm)) // [ [ 36, 26, -26, -40, -56 ], [ 36, 26, -26, -40, -55 ] ] arr = [ 45, 25, -19, 7, 46, -19, 36, -50, -57, 26, 46, 50, 20 ]; comm = '>>'; console.log('#5', longestComb(arr, comm)) // [ 45, 25, 7, -19, -50, -57 ]
3
1
New comment Apr 3
Theme
https://github.com/swkeever/tailwind-css-theme-demo/tree/main
4
2
New comment Feb 22
1-6 of 6
Developer Pro
skool.com/developerpro
Learn how to code. Make money. Have fun. Enjoy life.
Leaderboard (30-day)
powered by