Skip to content

boglarkasebestyen/JavaScriptmas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

43 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

What is JavaScriptmas?๐ŸŽ„

JavaScriptmas is a 24-day long, daily coding challenge organized by the Norwegian online coding school, Scrimba, starting from December 1st until December 24th, 2020. It strictly consists of JavaScript exercises, as its name suggests.

In this repository I committed all my solutions to the exercises. My certificate of completion can be viewed on LinkedIn.

Scrimba's Advent Calendar containing all of the exercises can be found here.

Day 1 - Candies

n children have got m pieces of candy. They want to eat as much candy as they can, but each child must eat exactly the same amount of candy as any other child. Determine how many pieces of candy will be eatin by all the children together. Individual pieces of candy cannot be split.

Solution here.

Day 2 - Deposit Profit

You have deposited a specific amount of dollars into your ban account. Each year your balance increases at the same growth rate. Found out how long it would take for yout balance to pass a specific threshold with the assumption that you don't make any additional deposits.

Solution here.

Day 3 - Chunky Monkey

Write a function that splits an array (first argument) into groups the length of size (second argument) and returns them as a two-dimensional array.

Solution here.

Day 4 - Century from a Year

Given a year, return the century it is in. The first century spans from the year 1 up to and including the year 100. The second from the year 101 up to and including the year 200, etc.

Solution here.

Day 5 - Reverse a String

Reverse the provided string. You may need to turn the string into an array before you reverse it. Your result must be a string.

Solution here.

Day 6 - Sort by Length

Given an array of strings, sort them in the order of increasing lengths. If two strings have them same length, their relative order must be the same as in the initial array.

Solution here.

Day 7 - Count Vowel Consonant

You are given a string s that consist of only lowercase English letters. If vowels ('a', 'e', 'i', 'o', 'u') are given a value of 1 and consonants are given a value of 2, return the sum of all of the letters in the input string.

Solution here.

Day 8 - Rolling Dice

In this challenge a casino has asked you to make an online dice that works just like it would in real life. Using the pre-made dice face that represents โ€˜oneโ€™, make the faces for โ€˜twoโ€™, โ€˜threeโ€™, โ€˜fourโ€™, โ€˜fiveโ€™ and โ€˜sixโ€™. Now, when the users click the dice on the screen, the dice is expected to show one of the faces randomly.

Solution here.

Day 9 - Sum Odd Fibonacci

Given a positive integer num, return the sum of all odd Fibonacci numbers that are less than or equal to num. The first two numbers in the Fibonacci sequence are 1 and 1. Every additional number in the sequence is the sum of the two previous numbers. The first six numbers of the Fibonacci sequence are 1,1,2,3,5 and 8.

Solution here.

Day 10 - Adjacent Elements Product

Given an array of integers, find the pair of adjacent elements that has the largest product and return that product.

Solution here.

Day 11 - Avoid Obstacles

You are given an array of integers representing coordinates of obstacles situated on a straight line. Assume that you are jumping from the point with coordinate 0 to the right. Ypu are allowed only to make jumps of the same length represented by some integer. Find the minimal length of the jump enough to avoid all the obstacles.

Solution here.

Day 12 - Valid Time

Check if the given string is a correct time representation of the 24-hour clock.

Solution here.

Day 13 - Extract Each Kth

Given an array of integers, remove each kth element from it.

Solution here.

Day 14 - Maximal Adjacent Difference

Given an array of integers, find the maximal absolute difference between any two of its adjacent elements.

Solution here.

Day 15 - JavasScript Carousel

  • Use JS to make the carousel function
  • Left & right arrows should work
  • Bonus: use CSS transitions

Solution here.

Day 16 - Insert Dash

Transform a given sentence into a new one with dashes between each two consecutive letters.

Solution here.

Day 17 - Different Symbols Naive

Given a string, find the number of different characters in it.

Solution here.

Day 18 - Array Previous Less

Given an array of integers, for each position i, search among the previous positions for the last (from the left) position that contains a smaller value. Store that value at position i in the answer. If no such value can be found, store -1 instead.

Solution here.

Day 19 - Alphabet Subsequence

Check whether the given string is a subsequence of the plaintext alphabet.

Solution here.

Day 20 - Domain Type

GoDaddy makes a lot of different top-level domains available to its customers. A top-level domain is one that goes directly after the last dot ('.') in the domain name, for example, .com in example.com. To help the users choose from available domains, GoDaddy is introducing a new feature that shows the type of the chosen top-level domain. You have to implement this feature. To begin with, you want to write a function that labels the domains as "commercial", "organization", "network", or "information" for .com, .org, .net or .info, respectively. For the given list of domains, return the list of their labels.

Solution here.

Day 21 - Sum of 2

You have two integer arrays, and b, and an integer target value v. Determine whether there is a pair of numbers, where one is taken from a and the other from b that can be added together to get a sum of v. Return true if such a pair exists, otherwise return false.

Solution here.

Day 22 - Extract Matrix Column

Given a rectangular matrix and an integer column, return an array containing the elements of the columnth column of the give matrix (the leftmost column is the 0th one).

Solution here.

Day 23 - Social Media Input

We are making a Social Media Character Counter! We want to display the available characters LEFT. Using the keydown() event should help you here. When the characters reach 20 and below, we want them to turn red. So we will use Javascript to add that styling to it. If the characters drop below 0, we want the button to be disabled BUT if there are only 0 characters left, we should still be able to tweet.

Solution here.

Day 24 - Test Your Agility

Make a counter that increments every 75 miliseconds in the spin() function and displays whether the player wins or loses in the stop() function.

Solution here.