Git Product home page Git Product logo

frontend-bootcamp's Introduction

FrontEnd BootCamp Course

Just learning the basics of Front End development (JS, HTML, CSS)

JavaScript

1. Variables

  • const: for variables that are not expected to change
  • let: for variables that are expected to change

2. Operators

3. Functions, Conditionals & Loops

4. Built-in JavaScript methods

5. Callback functions

  • A callback function is a function that is passed as an argument to another function
const myArray = [2,4,5];
const callback = (item) => (item * 2);
myArray.map(callback); // Once the map function has iterated the array, the callback returns the value multiplied by 2

6. JavaScript primitives

7. JavaScript dates

8. Regular expressions

  • A regular expresion RegExp is used to match a text with a certain pattern
const myStr = "hello world, 2023 @ more of a string";
/^[a-z ]+,[0-9 ]+@[a-z ]+$/.exec(myStr); // We matched the exact pattern of myStr

9. JavaScript String methods

  • Most used String methods
  1. replaceAll(): returns a string with all matches of a pattern replaced by a replacement (in this case, the pattern is a RegExp):
cons myStr = "My Dog jumped on the bed. My dog is a bad Dog";
const newStr = myStr.replaceAll(/Dd{1}og)/g, "cat"); // We replace cat for all Dog/dog instances
  1. toUpperCase(): returns the string value converted to uppercase
  2. substring(): returns a specific substring from a string within a specified range
  3. trim(): removes the whitespaces around the string and returns a new string
const myStr = "  Hello World!  ";
myStr.trim(); // Expected output: "Hello World!"
  1. match(): retrieves the result of matching a string against a RegExp
const myStr = "I'm learning JavaScript";
const found = myStr.match(/[A-Z]g/); // Expected output: Array["I","J","S"]

10. JavaScript Array methods

  • Most used Array methods
  1. push(),pop(),shift(),unshift()
const myArray = [1,2,3,4,5]
myArray.pop();       // Pops the element '5' out of the array
myArray.push(6);     // Pushes the element '6' at the end of the array
myArray.shift();     // Removes the first element which is '1'
myArray.unshift(0);  // Adds the element '0' at the beginning of the array
  1. slice(): returns the portion of an array from start to end
const myArray = [1,2,3,4,5,6];
const myCopyArray = myArray.slice(3); // Expected output: [4.5.6]
  1. splice(): changes the content of an array by removing or replacing existing elements and/or adding new elements in place
  2. findIndex(): returns the index of the first element that satisfies the callback function given as a parameter
const myArray = [1,2,12,33];
const callback = (element) => element > 13;
myArray.findIndex(callback); // Expected output: 3
  1. map(): creates a new array with the outputs of calling the callback function on every element of the array
  2. forEach(): executes the callback function for each element of the array
const myArray = ['a','b','c'];
myArray.forEach((elem) => console.log(elem)); // Expected output: 'a', 'b', 'c'
  1. includes(): determines whether an array includes the given element returning false or true
  2. filter(): creates a portion of the array filtered by the given function
const myArray = ['tree', 'sun', 'dog', 'sky'];
const newArray = myArray.filter((elem) => elem.length == 3); // Expected output: Array['sun', 'dog', 'sky']
  1. reduce(): executes a reducer function on each element of an array
const myArray = [1,2,3,4];
const initialValue = 0;
const sumArrayValue = myArray.reduce((acc, current) => acc + current, initialValue); // Expecte output: 10

11. Math utilities


Course by freeCodeCamp.org

frontend-bootcamp's People

Contributors

aryavert23 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.