/Freecodecamp-JS

Solutions for JavaScript Algorithms and Data Structures @

Primary LanguageJavaScript

JavaScript Algorithms and Data Structures Freecodecamp

This is a repository for putting solutions of various Freecodecamp Data stuctures and Algorithm Solutions.

Topics covered throughout the course include

Basic JavaScript

JavaScript is a scripting language you can use to make web pages interactive. It is one of the core technologies of the web, along with HTML and CSS, and is supported by all modern browsers.

In this course, you'll learn fundamental programming concepts in JavaScript. You'll start with basic data structures like numbers and strings. Then you'll learn to work with arrays, objects, functions, loops, if/else statements, and more.

ES6

ECMAScript, or ES, is a standardized version of JavaScript. Because all major browsers follow this specification, the terms ECMAScript and JavaScript are interchangeable.

Most of the JavaScript you've learned up to this point was in ES5 (ECMAScript 5), which was finalized in 2009. While you can still write programs in ES5, JavaScript is constantly evolving, and new features are released every year.

ES6, released in 2015, added many powerful new features to the language. In this course, you'll learn these new features, including arrow functions, destructuring, classes, promises, and modules.

Regular Expressions

Regular expressions, often shortened to "regex" or "regexp", are patterns that help programmers match, search, and replace text. Regular expressions are very powerful, but can be hard to read because they use special characters to make more complex, flexible matches.

In this course, you'll learn how to use special characters, capture groups, positive and negative lookaheads, and other techniques to match any text you want.

Debugging

Debugging is the process of going through your code, finding any issues, and fixing them.

Issues in code generally come in three forms: syntax errors that prevent your program from running, runtime errors where your code has unexpected behavior, or logical errors where your code doesn't do what you intended.

In this course, you'll learn how to use the JavaScript console to debug programs and prevent common issues before they happen.

  • Use the JavaScript Console to Check the Value of a Variable
  • Understanding the Differences between the freeCodeCamp and Browser Console
  • Use typeof to Check the Type of a Variable
  • Catch Misspelled Variable and Function Names
  • Catch Unclosed Parentheses, Brackets, Braces and Quotes
  • Catch Mixed Usage of Single and Double Quotes
  • Catch Use of Assignment Operator Instead of Equality Operator
  • Catch Missing Open and Closing Parenthesis After a Function Call
  • Catch Arguments Passed in the Wrong Order When Calling a Function
  • Catch Off By One Errors When Using Indexing
  • Use Caution When Reinitializing Variables Inside a Loop
  • Prevent Infinite Loops with a Valid Terminal Condition

Basic Data Structures

Data can be stored and accessed in many ways. You already know some common JavaScript data structures — arrays and objects.

In this Basic Data Structures course, you'll learn more about the differences between arrays and objects, and which to use in different situations. You'll also learn how to use helpful JS methods like splice() and Object.keys() to access and manipulate data.

  • Use an Array to Store a Collection of Data
  • Access an Array's Contents Using Bracket Notation
  • Add Items to an Array with push() and unshift()
  • Remove Items from an Array with pop() and shift()
  • Remove Items Using splice()
  • Add Items Using splice()
  • Copy Array Items Using slice()
  • Copy an Array with the Spread Operator
  • Combine Arrays with the Spread Operator
  • Check For The Presence of an Element With indexOf()
  • Iterate Through All an Array's Items Using For Loops
  • Create complex multi-dimensional arrays
  • Add Key-Value Pairs to JavaScript Objects
  • Modify an Object Nested Within an Object
  • Access Property Names with Bracket Notation
  • Use the delete Keyword to Remove Object Properties
  • Check if an Object has a Property
  • Iterate Through the Keys of an Object with a for...in Statement
  • Generate an Array of All Object Keys with Object.keys()
  • Modify an Array Stored in an Object

Basic Algorithm Scripting

An algorithm is a series of step-by-step instructions that describe how to do something.

To write an effective algorithm, it helps to break a problem down into smaller parts and think carefully about how to solve each part with code.

In this course, you'll learn the fundamentals of algorithmic thinking by writing algorithms that do everything from converting temperatures to handling complex 2D arrays.

  • Convert Celsius to Fahrenheit
  • Reverse a String
  • Factorialize a Number
  • Find the Longest Word in a String
  • Return Largest Numbers in Arrays
  • Confirm the Ending
  • Repeat a String Repeat a String
  • Truncate a String
  • Finders Keepers
  • Boo who
  • Title Case a Sentence
  • Slice and Splice
  • Falsy Bouncer
  • Where do I Belong
  • Mutations
  • Chunky Monkey

Object Oriented Programming

OOP, or Object Oriented Programming, is one of the major approaches to the software development process. In OOP, objects and classes organize code to describe things and what they can do.

In this course, you'll learn the basic principles of OOP in JavaScript, including the this keyword, prototype chains, constructors, and inheritance.

  • Create a Basic JavaScript Object
  • Use Dot Notation to Access the Properties of an Object
  • Create a Method on an Object
  • Make Code More Reusable with the this Keyword
  • Define a Constructor Function
  • Use a Constructor to Create Objects
  • Extend Constructors to Receive Arguments
  • Verify an Object's Constructor with instanceof
  • Understand Own Properties
  • Use Prototype Properties to Reduce Duplicate Code
  • Iterate Over All Properties
  • Understand the Constructor Property
  • Change the Prototype to a New Object
  • Remember to Set the Constructor Property when Changing the Prototype
  • Understand Where an Object’s Prototype Comes From
  • Understand the Prototype Chain
  • Use Inheritance So You Don't Repeat Yourself
  • Inherit Behaviors from a Supertype
  • Set the Child's Prototype to an Instance of the Parent
  • Reset an Inherited Constructor Property
  • Add Methods After Inheritance
  • Override Inherited Methods
  • Use a Mixin to Add Common Behavior Between Unrelated Objects
  • Use Closure to Protect Properties Within an Object from Being Modified Externally
  • Understand the Immediately Invoked Function Expression (IIFE)
  • Use an IIFE to Create a Module

Functional Programming

Functional Programming is another popular approach to software development. In Functional Programming, code is organized into smaller, basic functions that can be combined to build complex programs.

In this course, you'll learn the core concepts of Functional Programming including pure functions, how to avoid mutations, and how to write cleaner code with methods like .map() and .filter().

Intermediate Algorithm Scripting

Now that you know the basics of algorithmic thinking, along with OOP and Functional Programming, test your skills with the Intermediate Algorithm Scripting challenges.

  • Sum All Numbers in a Range
  • Diff Two Arrays
  • Seek and Destroy
  • Wherefore art thou
  • Spinal Tap Case
  • Pig Latin
  • Search and Replace
  • DNA Pairing
  • Missing letters
  • Sorted Union
  • Convert HTML Entities
  • Sum All Odd Fibonacci Numbers
  • Sum All Primes
  • Smallest Common Multiple
  • Drop it
  • Steamroller
  • Binary Agents
  • Everything Be True
  • Arguments Optional
  • Make a Person
  • Map the Debris

JavaScript Algorithms and Data Structures Projects

This is it — time to put your new JavaScript skills to work. These projects are similar to the algorithm scripting challenges you've done before – just much more difficult.

Complete these 5 JavaScript projects to earn the JavaScript Algorithms and Data Structures certification.

  • Palindrome Checker
  • Roman Numeral Converter
  • Caesars Cipher
  • Telephone Number Validator
  • Cash Register