10/01/2020 ✖
JS Coursework Challenge 2
file:///C:/Users/david/Desktop/js_cwk_2_2019/index.html 1/3
JS Coursework Challenge 2
Hide passed tests Check for Globals No try-catch
1. global failure
Rerun
2. Characters: Create a word scoring func�on ‘sumOfCharacters’ that accepts a string and returns the sum of the values of its
UTF-16 character codes. e.g. ‘A’=65, ‘AB’=131 (i.e. 65+66), etc. Rerun
Source: at file:///C:/Users/david/Desktop/js_cwk_2_2019/tests.js:8:1
3. Words: Create a func�on ‘sentenceWordSums’ that takes one parameter which is a sentence (i.e. words separated by spaces),
The func�on must return an array containing the sum of the characters for each word. Rerun
Source: at file:///C:/Users/david/Desktop/js_cwk_2_2019/tests.js:28:1
4. Sentence Sums: Create a func�on ‘sumOfSentence’ that takes two parameters, the first is a sentence (i.e. space separated
words), the second is a number that represents a minimum length. The func�on must return a single number that is the sum of
the values of the sentences’ UTF-16 character codes. When summing the characters, words whose length is less than the
second parameter should be ignored. Rerun
Source: at file:///C:/Users/david/Desktop/js_cwk_2_2019/tests.js:68:1
5. Palindrome: Create a func�on ‘palindrome’ that accepts two parameters: a string parameter, and a boolean. The func�on
returns true if the string provided is a palindrome. If the second parameter is true, whitespace must be ignored by the test, so
e.g. both ‘a ha’ and ‘abb a’ would be recognised as palindromes. Rerun
Source: at file:///C:/Users/david/Desktop/js_cwk_2_2019/tests.js:150:1
6. Emojify: Create a func�on called ’emojify’ that accepts one parameter, a string, and converts special character sequences to
emoji before returning the improved string. The special sequences are ‘(TM)’, ‘<3', and ':-)'. Your func�on should convert them
to ™ , ❤ , and ?, respec�vely. Rerun
Source: at file:///C:/Users/david/Desktop/js_cwk_2_2019/tests.js:221:1
7. Page Emojify: Create a func�on called ‘pageEmojify’ that accepts one parameter which is a CSS selector, and having selected
that element, uses the emojify func�on in order to replace any shortcuts with their respec�ve emoji. Rerun
Source: at file:///C:/Users/david/Desktop/js_cwk_2_2019/tests.js:244:1
8. Tree Emojify: Create a func�on called ‘treeEmojify’ that accepts one parameter which is a CSS selector. All child elements and
all text within the selected element should be modified such that all text is transformed using the emojify func�on. The func�on
must only change text inside the element, and inside child elements. The element structure of the document must not change.
Rerun
Source: at file:///C:/Users/david/Desktop/js_cwk_2_2019/tests.js:274:1
9. Click A�acher: Create a func�on called ‘clickA�acher’ that accepts two parameters. The first parameter is a CSS selector and
the second is a class name. The func�on should add an event listener to all the selected elements iden�fied by the selector.
Create an event handler func�on that is invoked upon a ‘click’ event. It should toggle the provided classname on the clicked
element. Rerun
Source: at file:///C:/Users/david/Desktop/js_cwk_2_2019/tests.js:298:1
10. Write a drawSal�re func�on that accepts one parameter ‘elem’ which is a canvas. It should draw the Sco�sh flag to fit the
canvas. Rerun
Source: at file:///C:/Users/david/Desktop/js_cwk_2_2019/tests.js:366:1
11. Write a drawUnion func�on that accepts one parameter ‘elem’ which is a canvas. It should draw the Union Jack to fit the
canvas. Rerun
file:///C:/Users/david/Desktop/js_cwk_2_2019/index.html
file:///C:/Users/david/Desktop/js_cwk_2_2019/index.html?testId=812a1d29
file:///C:/Users/david/Desktop/js_cwk_2_2019/index.html?testId=54d42082
file:///C:/Users/david/Desktop/js_cwk_2_2019/index.html?testId=0cbcd825
file:///C:/Users/david/Desktop/js_cwk_2_2019/index.html?testId=8a3d211e
file:///C:/Users/david/Desktop/js_cwk_2_2019/index.html?testId=801a1ec7
file:///C:/Users/david/Desktop/js_cwk_2_2019/index.html?testId=2b87b465
file:///C:/Users/david/Desktop/js_cwk_2_2019/index.html?testId=6a1d4e1c
file:///C:/Users/david/Desktop/js_cwk_2_2019/index.html?testId=5f526d76
file:///C:/Users/david/Desktop/js_cwk_2_2019/index.html?testId=4246f9eb
file:///C:/Users/david/Desktop/js_cwk_2_2019/index.html?testId=17a08013
file:///C:/Users/david/Desktop/js_cwk_2_2019/index.html?testId=5c77457f
10/01/2020 ✖ JS Coursework Challenge 2
file:///C:/Users/david/Desktop/js_cwk_2_2019/index.html 2/3
Source: at file:///C:/Users/david/Desktop/js_cwk_2_2019/tests.js:380:1
12. Advanced Challenge: Write a makePi func�on that takes two parameters. The first parameter ‘elem’ is a container in which
your func�on should append a new canvas element that it creates. The second parameter ‘data’ is an array of data that needs to
be visualised. The data is composed of mul�ple objects. Each object has a name and a value, for example: [ {“name”: “apples”,
“value”: 25}, {“name”: “bananas”, “value”: 25}, {“name”: “carrots”, “value”: 10}, {“name”: “tomatoes”, “value”: 40} ] You may
present your pi chart any way you wish so long as we are able to interpret it. You will need to work with the arc func�on to
achieve this challenge… it is not trivial! Rerun
Source: at file:///C:/Users/david/Desktop/js_cwk_2_2019/tests.js:394:1
Emoji
🙂
(TM)
SoftEng(TM) 🙂
Do you <3 me now?
:-):-):-)<3<3<3
Emoji Advanced
🙂
(TM)
SoftEng(TM) 🙂
Do you <3 me now?
:-):-):-)<3<3<3
Click me
Click me
Click me
Click me
Click me
Draw the flag of Scotland
file:///C:/Users/david/Desktop/js_cwk_2_2019/index.html?testId=7d52ce12
10/01/2020 ✖ JS Coursework Challenge 2
file:///C:/Users/david/Desktop/js_cwk_2_2019/index.html 3/3
It should look like this:
Draw the Union Jack
It should look like this:
Pies
We provide professional writing services to help you score straight A’s by submitting custom written assignments that mirror your guidelines.
Get result-oriented writing and never worry about grades anymore. We follow the highest quality standards to make sure that you get perfect assignments.
Our writers have experience in dealing with papers of every educational level. You can surely rely on the expertise of our qualified professionals.
Your deadline is our threshold for success and we take it very seriously. We make sure you receive your papers before your predefined time.
Someone from our customer support team is always here to respond to your questions. So, hit us up if you have got any ambiguity or concern.
Sit back and relax while we help you out with writing your papers. We have an ultimate policy for keeping your personal and order-related details a secret.
We assure you that your document will be thoroughly checked for plagiarism and grammatical errors as we use highly authentic and licit sources.
Still reluctant about placing an order? Our 100% Moneyback Guarantee backs you up on rare occasions where you aren’t satisfied with the writing.
You don’t have to wait for an update for hours; you can track the progress of your order any time you want. We share the status after each step.
Although you can leverage our expertise for any writing task, we have a knack for creating flawless papers for the following document types.
Although you can leverage our expertise for any writing task, we have a knack for creating flawless papers for the following document types.
From brainstorming your paper's outline to perfecting its grammar, we perform every step carefully to make your paper worthy of A grade.
Hire your preferred writer anytime. Simply specify if you want your preferred expert to write your paper and we’ll make that happen.
Get an elaborate and authentic grammar check report with your work to have the grammar goodness sealed in your document.
You can purchase this feature if you want our writers to sum up your paper in the form of a concise and well-articulated summary.
You don’t have to worry about plagiarism anymore. Get a plagiarism report to certify the uniqueness of your work.
Join us for the best experience while seeking writing assistance in your college life. A good grade is all you need to boost up your academic excellence and we are all about it.
We create perfect papers according to the guidelines.
We seamlessly edit out errors from your papers.
We thoroughly read your final draft to identify errors.
Work with ultimate peace of mind because we ensure that your academic work is our responsibility and your grades are a top concern for us!
Dedication. Quality. Commitment. Punctuality
Here is what we have achieved so far. These numbers are evidence that we go the extra mile to make your college journey successful.
We have the most intuitive and minimalistic process so that you can easily place an order. Just follow a few steps to unlock success.
We understand your guidelines first before delivering any writing service. You can discuss your writing needs and we will have them evaluated by our dedicated team.
We write your papers in a standardized way. We complete your work in such a way that it turns out to be a perfect description of your guidelines.
We promise you excellent grades and academic excellence that you always longed for. Our writers stay in touch with you via email.