JavaScript is a widely used web among programming language. I recently had a 30 Days of JavaScript Tips challenge on Twitter (now, X) where I shared 30 different JavaScript tips with my followers daily for 30 days. I decided to compile those tips into one giant tutorial for campers and everyone else on the internet.

20m read timeFrom freecodecamp.org
Post cover image
Table of contents
What We'll CoverTip 1: Use console.table() to Display Arrays and Objects in the ConsoleTip 2: Use Template Interpolation to Render Strings Instead of the Assignment OperatorTip 3: Convert Strings to Numbers with Unary Plus and Number ConstructorTip 4: You Don’t Need to Declare Every Variable with a KeywordTip 5: Use console.group() with Multiple console.log() s to Group Related Itmes to the ConsoleTip 6: Style your Console Output with the %c SpecifierTip 7: How Math.floor(Math.random() * n1 + n2) Generates a Random Number Between n1 and n2Tip 8: Methods of the Math ObjectTip 9: Capitalize the First Letter of Any WordTip 10: Destructure Arrays with Default Values to Avoid Getting undefinedTip 11: Use the Spread Operator to Copy and Merge ArraysTip 12: Use Arrow Syntax to Write Shorter and More Elegant FunctionsTip 13: Use Destructuring to Extract Properties from ObjectsTip 14: Use the startsWith() and endsWith() String Methods to Get the Start and End of a StringTip 15: Use the trim() , trimStart() , and trimEnd() to Handle White SpacesTip 16: Use replace() with the toUpperCase() and toLowerCase() Methods to Convert Between CasesTip 17: Use the Array.from() Method to Create Arrays from Array-like Objects or IterablesTip 18: Use the map() Method to Transform all the Elements of an ArrayTip 19: Use the filter() Method to Filter Through ArraysTip 20: Use the forEach() Method to Loop Through ArraysTip 21: Use the Web Audio API to Work with Audio FilesTip 22: Use the Web Video API to Work with Video FilesTip 23: Preserve Object Integrity by Sealing and Freezing ThemTip 24: Use async...await For Asynchronous OperationsTip 25: Clone Objects with the Spread Operator, Object.assign() , and JSON.parse()Tip 26: Remove Duplicates from an Array with Set and MapTip 27: Map Through and Array and Flatten it with the flatMap() MethodTip 28: Use the padStart() and padEnd() Methods to Pad a string with a CharacterTip 29: Use the insertAdjacentHTML() method of DOM to Insert a String into the DOMTip 30: Use the createTreeWalker() DOM Method to Traverse the DOMConclusion
10 Comments

Sort: