Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hii again, here are my solutions for day 20 and day 21.
What I did:
First Tweet π¦
Defined 3 variables:
charsLeftβ the character limit, initialized to140.countβ a running total of characters typed, initialized to0.stringβ an array of the tweet's words, split on spaces.Iterated over each word in string using a
for...ofloop.Applied different character counts based on the type of each word:
@) β counted as 20 chars.http://orhttps://) β counted as 23 chars.Added
1tocountper word to account for the space following it.Returned the remaining characters as
charsLeft - count.Water Day π§
Defined 4 variables:
currentVolumeβ the initial volume of water.lossRateβ the leak.iterationsβ the number of hours.waterRemainingβ the final volume of water.Created a loop using a classic
forloop.Calculated the fixed percentage a pipe loses each hour with β new volume = current volume * (1 - leak/100).
Added a condition to return the volume of water remaining after all hours have passed:
currentVolume >= threshold, returnswaterRemaining = Number(currentVolume.toFixed(2)).-1.Let me know if there's anything to fix!
shercodes π