Question: (0) I need some help with this please I can't figure it out. ****************************************************************************** * Problem 2: create an HTML element with the given content.

(0)

I need some help with this please I can't figure it out.

******************************************************************************

* Problem 2: create an HTML element with the given content.

*

* In HTML, a element is used to represent metadata about a web page. For

* example: who is tha page's author?

*

* If I wanted to indicate that a web page was written by Kim Lee, I would use

* the following tag:

*

*

*

* See the following for more details about the tag:

*

* - https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta

* - https://developer.mozilla.org/en-US/docs/Web/HTML/Element/metaame

*

* Write a function named createMetaTag() which accepts both name and content values.

* It should use these values to produce a new tag string. For example:

*

* createMetaTag('description', 'Course notes for WEB222')

*

* should return the following string of HTML:

*

* ''

*

* Make sure you remove any leading or trailing whitespace from the name and content

* values before you use them.

*

* createMetaTag('description', ' Course notes for WEB222 ')

*

* should return the following string of HTML:

*

* ''

*

* Also, the double-quotes around name and content are optional if the value

* does NOT contain any of the following characters: space, tab, new line, line feed:

*

* ''

* ''

*

* When creating your string, only include double-quotes when necessary.

*

* @param {string} name - the value for the name attribute

* @param {string} content - the value for the content attribute

* @returns {string} - a properly formatted tag

******************************************************************************/

function createMetaTag(name, content) {

// Replace this comment with your code...

Problem 6: format any number of durations as a list in a string

*

* You are asked to format time durations (hour, min, sec) in a list using your

* normalizeDuration() function from problem 5.

*

* Where normalizeDuration() takes a single duration string, the formatDurations()

* function takes a list of any number of duration strings, parses them,

* filters out any invalid ones, and creates a list.

*

* For example: given the following durations, "1h13m2s" and "4:16:24",

* a new list would be created of the following form "((1, 13, 2), (4, 16, 24))".

*

* Notice how the list has been enclosed in an extra set of (...) braces, and each

* duration is separated by a comma and space.

*

* The formatDurations() function can take any number of arguments, but they must all

* be strings. If any of the values can't be parsed by normalizeDuration() (i.e., if

* it returns null), skip the value. For example:

*

* formatDurations("1h13m2s", "300:600:900", "4:16:24") should return

* "((1, 13, 2), (4, 16, 24))" and skip the invalid duration.

*

* @param {number} arguments - any number of string duration arguments can be passed

* @returns {string}

******************************************************************************/

function formatDurations(...values) {

// Replace this comment with your code...

******************************************************************************

* Problem 8: generate badge text and link from license code.

*

* Images, videos, and other resources on the web are governed by copyright.

* Everything you find on the web is copyright to its creator automatically, and

* you cannot reuse it unless you are granted a license to do so.

*

* Different licenses exist to allow creators to share their work. For example,

* the Creative Commons licenses are a popular way to allow people to reuse

* copyright material, see https://creativecommons.org/licenses/.

*

* Below is a list of license codes, and the associated badge text explaining the code:

*

* Code License Name

* ----------------------------------------------------------------------------

* CC-BY: Creative Commons Attribution License

* CC-BY-NC: Creative Commons Attribution-NonCommercial License

* CC-BY-SA: Creative Commons Attribution-ShareAlike License

* CC-BY-ND: Creative Commons Attribution-NoDerivs License

* CC-BY-NC-SA: Creative Commons Attribution-NonCommercial-ShareAlike License

* CC-BY-NC-ND: Creative Commons Attribution-NonCommercial-NoDerivs License

*

* NOTE: any other licenseCode should use the URL https://choosealicense.como-permission/

* and the explanation text, "All Rights Reserved"

*

* Write a function, generateLicenseBadge(), which takes a license code string, and returns

* an HTML link to the appropriate badge (i.e., image) URL, including the badge text.

*

* For example:

*

* generateLicenseBadge('CC-BY-NC') should return the following HTML string:

*

* '(0) I need some help with this please I can't'

*

* The URL is generated based on the license code:

*

* - remove the `CC-` prefix

* - convert to rest to lower case

* - create a license URL using the formatted code: https://creativecommons.org/licenses/[...here]/4.0/

* - create a badge image URL using the formatted code: https://licensebuttons.net/l/[...here]/4.0/88x31.png

* - create an and tag, using the license name as alt text

*

* You can read more about HTML image links at https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img

*

* @param {string} licenseCode - a license code

* @returns {string}

******************************************************************************/

function generateLicenseBadge(licenseCode) {

******************************************************************************

* Problem 10 - build a query string

*

* Querying a web data API involves formatting a query string in a particular way.

* As we know from week 1, a query string is a set of name=value pairs, that starts

* with the ? character, and each pair is separated by the & character, see:

* https://web222.ca/weeks/week01/#query-strings

*

* For example:

*

* ?q=dog&sort=ascending includes q=dog and sort=ascending

* ?_encoding=UTF8&node=18521080011 includes both _encoding=UTF8 and also node=18521080011

*

* Write a buildQueryString() function to build a query string based on arguments

* passed by the caller.

*

* The buildQueryString() function accepts the following arguments:

*

* - queryTerm: a search string, for example "butterfly" or "Horse-chestnut"

* - sortOrder: a string indicating sort order, with possible values of `ascending` or `descending`

* - count: a number from 10 to 200, indicating how many results to return per page

*

* Write an implementation of buildQueryString() that accepts arguments for all of the above

* parameters, validates and formats them (e.g., encode the query, count must be between 10

* and 200, etc), and returns a properly formatted query string.

*

* For example:

*

* buildQueryString('Monarch Butterfly', 'ascending', 25) would return the following query string:

*

* '?query_term=Monarch%20Butterfly&count=25

*

* NOTE: the default sort order is ascending, so it isn't included. However, if we were to

* specify 'descending', it would need to get added:

*

* buildQueryString('Monarch Butterfly', 'descending', 25) would return the following query string:

*

* '?query_term=Monarch%20Butterfly&count=25&descending

*

* NOTE: if any of the values passed to buildQueryString() are invalid, an Error should be thrown.

*

* NOTE: make sure you properly encode the query value, since query strings can't contain

* spaces or other special characters. HINT: use the encodeURIComponent() function

* to do this, see:

*

* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent

*

* @param {string} queryTerm the query to use.

* @param {string} sortOrder the sort order to use, must be one of `ascending` or `descending`

* @param {number} count the number of results per page, must be 10-200

* @returns {string} the properly formatted query string

******************************************************************************/

function buildQueryString(queryTerm, sortOrder, count) {

// Replace this comment with your code..

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!