generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 13
London | Samira Hekmati | Module Tools | Week 2 | jq #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
samirahekmati
wants to merge
14
commits into
CodeYourFuture:main
Choose a base branch
from
samirahekmati:jq
base: main
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 all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
5dc1072
format JSON file with Prettier
samirahekmati e09a003
`jq` command to output the name of the person
samirahekmati 9ab104f
Extract address details correctly using `jq`
samirahekmati a7caeab
output the name ,a comma,then profession with `jq`
samirahekmati 85c82b3
output just the names of each player with`jq`
samirahekmati b573926
output the names of players&their city with `jq`
samirahekmati 619b4c9
output the names with their first score with `jq`
samirahekmati 2122968
output the names and their last score with `jq`
samirahekmati 8bec120
output the number of games they played with `jq`
samirahekmati 5d9f6b1
output total scores from all games added together
samirahekmati b59299c
output the total of all players' first score
samirahekmati ccbdcc5
output sum of scores from all games,all players
samirahekmati 62f7867
changed variable name from `scores` to `lastScore`
samirahekmati 5018472
added a simpler solution
samirahekmati 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
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 +1,8 @@ | ||
[{"name": "Ahmed", "city": "London", "scores": [1, 10, 4]}, {"name": "Basia", "city": "London", "scores": [22, 9, 6]}, {"name": "Mehmet", "city": "Birmingham", "scores": [3, 12, 17]}, {"name": "Leila", "city": "London", "scores": [1]}, {"name": "Piotr", "city": "Glasgow", "scores": [15, 2, 25, 11, 8]}, {"name": "Chandra", "city": "Birmingham", "scores": [12, 6]}] | ||
[ | ||
{ "name": "Ahmed", "city": "London", "scores": [1, 10, 4] }, | ||
{ "name": "Basia", "city": "London", "scores": [22, 9, 6] }, | ||
{ "name": "Mehmet", "city": "Birmingham", "scores": [3, 12, 17] }, | ||
{ "name": "Leila", "city": "London", "scores": [1] }, | ||
{ "name": "Piotr", "city": "Glasgow", "scores": [15, 2, 25, 11, 8] }, | ||
{ "name": "Chandra", "city": "Birmingham", "scores": [12, 6] } | ||
] |
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
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
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
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
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
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
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
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
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
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
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
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.
In script-03 you used
join
and here you used string interpolation - both work, and both could be used in both places - do you have any thoughts on which you prefer / which is more clear?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.
Thank you so much Daniel, @illicitonion for your feedback! I agree that both methods join(", ") and string interpolation are valid, and it's interesting to think about their usage in different contexts.
For example in script-03, I chose join(", ") as I felt it was a cleaner way to handle the array of values (in this case, name and profession). It also keeps the structure clear by dealing with the array directly. On the other hand, in script-05, I used string interpolation because it was more intuitive for handling the dynamic insertion of values within a string.
I don't have a strong preference for one over the other, but I can see how string interpolation may be more flexible, especially if we were working with more complex strings or needing more control over formatting.
I think, if clarity and simplicity are the primary goals, join(", ") works well for array type of structures, while string interpolation might be more readable when we're dealing with individual elements or values.