Question: Question: Generate badge text and link from license code. * * Images, videos, and other resources on the web are governed by copyright. * Everything
Question: 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:
*
* '
'
*
* 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) {
// Replace this comment with your code...
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
