This repository was archived by the owner on Oct 26, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 42
Java script core 1 homework/week1/osagie #32
Open
osagiestar
wants to merge
31
commits into
CodeYourFuture:master
Choose a base branch
from
osagiestar:JavaScript-Core-1-Homework/week1/Osagie
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
7178a43
first JS practice
osagiestar e0e8ecb
first JS practice
osagiestar 81ce14a
a change made
osagiestar e4ed185
F-strings exercise
osagiestar c376b43
G-numbers exercise
osagiestar a05a8b9
I-floatss exercise
osagiestar cd4d589
I-floats exercise
osagiestar e6a356a
J-functionss exercise
osagiestar 38a4447
J-functions exercise2
osagiestar be3ab99
K-functions exercise1
osagiestar 88ce31d
K-functions exercise2 answer no1
osagiestar fc834ac
K-functions 1-exercise// Complete the function so that it takes input…
osagiestar 38eef0b
K-functions 1-exercise Exercise 3
osagiestar d31a191
syntax debugging
osagiestar 06e8051
parenthesis for trim; none for length
osagiestar af4b3a6
function outputs for concatenate
osagiestar 5135f7f
learnt to use toFixed function for adding float to integers
osagiestar 4b5169e
learnt techniques for concatenation
osagiestar 3da6d6d
learnt techniques for concatenation of strings i.e joining strings to…
osagiestar bfd8e60
test the console.log() syntax
osagiestar 78141c0
test the console.log() syntax
osagiestar ee7a874
create variable aand output result
osagiestar 355834f
learnt how to use (typeof) syntax
osagiestar 08eee6f
use of + sign to join strings
osagiestar 86dfcb8
learnt the trim() syntax
osagiestar 0857676
implemented trim() syntax
osagiestar b949687
use of Math.round to convert floats/decimal numbers to whole integers
osagiestar b4fd296
calling a function
osagiestar cc4aa98
declare a function first and then call the function using console.log()
osagiestar 525d696
more work to be done
osagiestar c68d50f
learnt function in a function method
osagiestar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev
Previous commit
learnt function in a function method
- Loading branch information
commit c68d50fdcc3bb82c3166ee9e03dc166b0c5562f0
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,25 @@ | ||
var mentor1 = "Daniel"; | ||
var mentor2 = "Irina"; | ||
var mentor3 = "Mimi"; | ||
var mentor4 = "Rob"; | ||
var mentor5 = "Yohannes"; | ||
//Exercise 1// | ||
function percentProgram(firstNumber, secondNumber) { | ||
let overallTotal = firstNumber + secondNumber; | ||
|
||
let percentage = Math.floor((firstNumber / overallTotal) * 100); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Running this exercise returns 65% for students and 34% for mentors. The total is 99% not 100%, can you think why? |
||
return percentage; | ||
} | ||
|
||
function message(numberOfStudents, numberOfMentors) { | ||
let percentOfStudents = percentProgram(numberOfStudents, numberOfMentors); | ||
let percentOfMentors = percentProgram(numberOfMentors, numberOfStudents); | ||
let fullMessage = `Percentage students: ${percentOfStudents}% and Percentage mentors: ${percentOfMentors}%`; | ||
return fullMessage; | ||
} | ||
let finalMessage = message(15, 8); | ||
console.log(finalMessage); | ||
|
||
// console.log(`${comment1} ${approxPercent}%`); | ||
// console.log(`${comment2} ${approxPer}%`); | ||
|
||
// var mentor1 = "Daniel"; | ||
// var mentor2 = "Irina"; | ||
// var mentor3 = "Mimi"; | ||
// var mentor4 = "Rob"; | ||
// var mentor5 = "Yohannes"; |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you have demonstrated using function parameters nicely so I'm sure you can correct the other exercises above :)