Welcome to BHS Computer Science. If you are a student in the class, the first thing you need to do (and which we should have done in class) is set up your GitHub account.
Once you have a GitHub account, click “Log in to GitHub” below to proceed. Or you can click “Use anonymously” to play with the environment but you will not be able to save your work or submit assignments. (You can always log in later by clicking the at the top of the page.)
If you don’t have a GitHub account yet, please create one and then log in here for further instructions.
Congratulations! You have successfully connected this app to GitHub. However you are not yet a member of the GitHub organization for this class, something Mr. Seibel needs to set up for you.
This is your GitHub profile URL:
Click the clipboard icon to copy it and then submit it at this form so he can add you.
Congratulations! You have successfully connected this app to GitHub. And it looks like you have an invitation to join the GitHub organization for this class. You need to accept that invitation before you can proceed. The invite should be sent to whatever email you used when you created your GitHub account.
I see you are logged into GitHub and a member of the berkeley-high-cs GitHub organization. However there seems to have been some problem finishing the setup for your account. Please let Mr. Seibel know.
This is a tool for the BHS Computer Science class at Berkeley High School. It is intended to provide a simple environment for experimenting with Javascript without all the complexities of a full development environment such as ReplIt or Glitch which we may use later in the year.
It is also designed to take advantage of the browser’s ability to run Javascript natively. It does not need access to a server to run code making in extremely responsive even if the Wifi is flaking out.
Finally, under the covers it is saving work to a GitHub repository in a very simplified workflow that does not depend on immediately learning any git commands. Code written in this environment for each assignment is saved to a directory and branch specific to that assignment each time it is saved. Thus when the assignment is done, it is easy to go to GitHub and create a PR containing just the work on that assignment which can then be commented on and worked on further before it is turned in and merged to main.
You're all set! You don't need to worry about this yet but we have successfully created a GitHub repository for your work:
You can get to it any time by clicking on your GitHub username at the top-right of the screen.
This assessment consists of functions you need to write involving primarily string expressions. It is a closed book assessment. You should stay on this tab until you are done and there should be no talking. This assessment is about how much you understand. There are no automatic tests but you can use the REPL to test things yourself.
You can move through the questions with the arrows at the upper right
next to the 1 of indicator so if
you're not sure how to write one function move on to another one and
come back if you have time at the end. I want to see how much you do
know. Note: you can also click on
thingsLikeThis
in these instructions and the questions to
copy them to the clipboard to avoid spelling mistakes. (I.e. click to
copy and then ⌘-v to paste wherever you want.)
A useful method you might want to use in some of these questions:
indexOf()
which takes a single argument and returns the
index of the first occurrence of argument in the string on which the
method is called or -1 if the argument is not found. For instance,
'foobar'.indexOf('o')
returns 1
while
'foobar'.indexOf('z')
returns -1
.
When you are done, please click on your Github username above
and submit a GitHub pull request of the branch
and request me as a reviewer. Doing
this correctly is part of the assessment.
If you are unsure how to request a review, please ask for help!
Write a function named upToX
that takes a single
string argument and returns a string consisting of the
characters of the original string up to but not including the
first 'x'
. For instance
upToX('quixotic')
should return 'qui'
.
Write a function named charactersAround
that takes
two arguments, a string and an index into the string and returns
a string consisting of two characters, the one immediately
before the character at the given index and one and the one
immediately after the character at the given index. You can
assume that those characters exist, i.e. the index is not at the
beginning or end of the string. For instance
charactersAround('programming', 4)
should return
'ga'
.
Write a function named middle
that takes a single
string argument and returns a sting consisting of the the middle
of the argument, defined as the original string with the first
and last quarter removed. You can assume the number of
characters in the string is a multiple of four. For instance
middle('abcdefgh')
should return
'cdef'
.
Write a function named pair
that takes two string
arguments and returns a single string consisting of the two
arguments separated by the word and
. For instance
pair('peanut butter', 'jelly')
should return
peanut butter and jelly
.
Write a function named containsX
that takes a
single string argument and returns true
if it
contains an 'x'
and false
if it does
not. For instance containsX('flexible')
should
return true
and
containsX('smooth')
should return
false
.
Write a function named slug
that takes three string
arguments and returns a “slug” consisting of the three strings
joined together with hyphens and all in lower case. For instance
slug('Foo', 'Bar', 'BAZ')
would return
'foo-bar-baz'
.
Write a function named capitalize
that takes a
single string argument and returns a string with the same
characters but with the first character in upper case and all
remaining characters in lower case. For instance
capitalize('programming')
should return
'Programming'
.
Write a function named capitalizeName
that takes a
single string consisting of a first and last name separated by a
space and returns a string with the first and last name
separated by a space but capitalized using the
capitalize
function you just wrote. For instance
capitalizeName('fred flintstone')
should return
'Fred Flintstone'
. Note: you must use
capitalize
in this function to get full credit.