Each day I solve several challenges and puzzles from Codr's ranked mode. The goal is to reach genius rank, along the way I explain how I solve them. You do not need any programming background to get started, but you will learn a ton of new and interesting things as you go.
We need to fix two bugs 💧 and 🐼, both should be strings as required by the challenge. The third line of code goes like this:
R = (A + B). It creates a variable
R whose value is a "complex" string operation. The operation concatenates (combines) the string values of
B, from this result it takes the character at index two. The challenge requires
R to equal
k, so this means we need to make sure that the 2nd character in the combined string is the character
k. When we look at the possible options for 💧, we can find only one answer that contains the character
k at the 2nd index (or 3rd position). This value will ensure that the final condition is met; the value of 🐼 is no longer important so we can choose pretty much anything.
let A = 'cuk' let B = 'pap' let R = (A+B) // similar to: R = 'cukpap'
If you feel inspired and motivated to upgrade your coding + debugging skills, join me on the Road to Genius at https://nevolin.be/codr/
Top comments (1)