Filter
Exclude
Time range
-
Near
NaN === NaN is false. Wait… what? 😵 #JavaScriptTricks
1
2
455
🔥 How to Flat an Array in JavaScript In JavaScript, you can flatten nested arrays using multiple methods. A thread 🧵👇🏻 #javascript #learnjavascript #javascriptdeveloper #javascriptprojects #javascripttricks #reactjs #nextjs #nodejs #javascriptcourse #javascriptforbeginners #javascriptcoding #jsdeveloper #javascriptcode
35
15
79
3,101
JavaScript array methods 🚀🔥 1. Adding & Removing Elements push(item) → Adds an item at the end of the array. pop() → Removes the last item from the array. unshift(item) → Adds an item at the beginning of the array. shift() → Removes the first item from the array. ----------------------------------------------------- 2. Searching in an Array indexOf(item) → Returns the index of the first occurrence of an item (or -1 if not found). lastIndexOf(item) → Returns the index of the last occurrence of an item. includes(item) → Returns true if the item exists in the array, otherwise false. find(callback) → Returns the first matching element based on a condition. findIndex(callback) → Returns the index of the first matching element based on a condition. ----------------------------------------------------- 3. Modifying or Transforming Arrays map(callback) → Creates a new array by modifying each item. filter(callback) → Creates a new array with only the items that match a condition. reduce(callback, initialValue) → Reduces the array to a single value (e.g., sum of all numbers). forEach(callback) → Runs a function for each item (but doesn’t create a new array). some(callback) → Returns true if at least one item matches a condition. every(callback) → Returns true if all items match a condition. ----------------------------------------------------- 4. Sorting & Reversing sort(compareFunction) → Sorts the array (default is ascending, but can be customized). reverse() → Reverses the order of the elements in the array. ----------------------------------------------------- 5. Extracting & Combining Arrays slice(start, end) → Extracts a portion of an array (without modifying the original). splice(start, deleteCount, item1, item2, …) → Changes the array by adding/removing elements. concat(array2, array3, …) → Joins two or more arrays into a new array. flat(depth) → Flattens nested arrays into a single array (default depth is 1). join(separator) → Converts an array to a string, with elements separated by a given character. ----------------------------------------------------- 6. Converting & Checking Arrays toString() → Converts an array to a string. Array.isArray(value) → Checks if a value is an array (true or false). #JavaScript #JSDeveloper #LearnJavaScript #JavaScriptTutorial #Coding #JavaScriptArrays #ArrayMethods #JSArrayTips #CodingWithJS #JavaScriptTricks #WebDevelopment #coder #CodeNewbie #FrontendDeveloper #coding #ProgrammingTips #100DaysOfCode #react
25
7
39
2,876
Destructuring in JavaScript isn’t just for objects. You can swap variables without a temp variable: [a, b] = [b, a]; Clean and clever #JavaScriptTricks
1
1
7
3,759
What do you call a custom iterator that skips empty values? A selective scanner? Source: devhubby.com/thread/how-crea… #learntocode #softwaredevelopment #javascript #javascripttricks #create #value

8
21
30 Oct 2024
Do nested JavaScript objects send their parents to timeout when they can't find their ids? Source: devhubby.com/thread/how-to-g… #codingtips #tech #Javascript #javascripttricks #programming #ids

5
13
17 Oct 2024
Maitriser la console JavaScript ! Es tu vraiment sur de savoir logger dans la console JavaScript ? Je te présente des fonctions peu connues de la console ! youtu.be/Xm6_41MEwCg?si=epjv… via @YouTube #console #javascript #DevTips #JS #WebDev #JavaScriptTricks #LearnToCode #Frontend

1
26
3️⃣ Object.entries() 1. Get both keys and values as pairs. 2. Facilitates powerful looping and de-structuring. #CodingTips #TechTalk #JavaScriptTricks
1
2
3
15 Short JavaScript Examples To Improve Your Coding Skills Each example will show you the code snippet, the output, and the explanation of how it works. By following these examples, you will learn how to write clean and efficient JavaScript code that can solve various problems and tasks. You will also gain confidence and experience in using JavaScript for web development. We hope you enjoy these 15 short JavaScript examples and find them useful for your learning journey. Happy coding!😊 #LearnJavaScript #WebDevelopment #JavaScriptExamples #CodingSkills #WebDevelopment #ProgrammingTips #LearnJavaScript #JavaScriptTutorial #JavaScriptTricks #JavaScriptTips #CodeExamples
3
145
15 Short JavaScript Examples To Improve Your Coding Skills. In this video, we'll be going through 15 short and practical examples of JavaScript code that can help improve your coding skills. Whether you're new to #JavaScript or looking to improve your existing knowledge, these examples will demonstrate a variety of techniques and concepts that you can apply to your own projects. Each example will show you the code snippet, the output, and the explanation of how it works. You can also run the code online using a code editor like [CodePen] or [JSFiddle]. By following these examples, you will learn how to write clean and efficient JavaScript code that can solve various problems and tasks. You will also gain confidence and experience in using #JavaScript for web development. We hope you enjoy these 15 short JavaScript examples and find them useful for your learning journey. Happy coding!😊 We hope you find these examples helpful and that they inspire you to continue learning and improving your coding skills. Don't forget to like, comment, and follow me @CuongNguyenCNN for more helpful videos like this one! #LearnJavaScript #WebDevelopment #JavaScriptExamples #CodingSkills #WebDevelopment #ProgrammingTips #LearnJavaScript #JavaScriptTutorial #JavaScriptTricks #JavaScriptTips #CodeExamples #JavaScriptTutorial
5
155
Como testar métodos privados em JavaScript (ou qualquer linguagem) 💥 Quando se começa a trabalhar com testes unitários é normal ver que o projeto vai crescendo e ganhando abstrações 😥 Isso significa que funções que são somente utilizadas dentro de um único arquivo / contexto (e não fazem sentido serem expostas para usuários) são alteradas para serem acessadas somente internamente (funções privadas) Só que a grande questão é: como testar se não possuímos acesso externo à elas? 🤨 No projeto @Nodejs, implementamos testes que validam essas funções privadas sempre a partir de uma função publica 😎 Um exemplo: export function getAll(isAdmin) { const people = getPeople() if(!isAdmin) return { people } const dogs = getDogs() return { people, dogs } } De fora deste arquivo, você pode somente chamar a função getAll, mas precisa necessariamente testar que getDogs e getPeople fazem o que você espera. Então, você cria casos de teste enviando diferentes parâmetros para getAll e assim validar que as funções privadas funcionam como o esperado 💥 Via relatorio de cobertura de código, você consegue definir se seu teste está validando todas os caminhos que a função percorre, animal né? E se você quiser aprender mais sobre, é só clicar na minha foto e me seguir 🔥 #JavaScriptTips #CodeTesting101 #DevTips #JavaScriptSnippets #ProgrammingTutorials #WebDevInsights #JavaScriptTricks #CodeDebugging #TechTutorials #JSDevelopment
3
12
94
10,996