-
Notifications
You must be signed in to change notification settings - Fork 4.1k
[Edit] Javascript: raw() #7069
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
[Edit] Javascript: raw() #7069
Conversation
Did I meet the requirements? |
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.
Hey @SolidRenner thank you for contributing to codecademy docs! 😄
I've suggested a few changes, could you please review and modify those at your earliest convenience? Also, please remove the raw2.md and valueOf.md file from this branch.
Thank you! 😃
Title: '.raw()' | ||
Description: 'Used to get the raw string form of template literals.' | ||
Subjects: | ||
- 'Web Development' | ||
- 'Computer Science' | ||
Tags: | ||
- 'Strings' | ||
- 'Methods' | ||
CatalogContent: | ||
- 'paths/front-end-engineer-career-path' |
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.
Title: '.raw()' | |
Description: 'Used to get the raw string form of template literals.' | |
Subjects: | |
- 'Web Development' | |
- 'Computer Science' | |
Tags: | |
- 'Strings' | |
- 'Methods' | |
CatalogContent: | |
- 'paths/front-end-engineer-career-path' | |
Title: '.raw()' | |
Description: 'A template tag function (String.raw) that returns the raw (unescaped) string form of template literals.' | |
Subjects: | |
- 'Computer Science' | |
- 'Web Development' | |
Tags: | |
- 'Methods' | |
- 'Strings' | |
CatalogContent: | |
- 'introduction-to-javascript' | |
- 'paths/front-end-engineer-career-path' |
CatalogContent: | ||
- 'paths/front-end-engineer-career-path' | ||
--- | ||
|
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.
can we have an introductory para to the term here? Along with its use cases
|
||
## Syntax | ||
|
||
``` |
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.
``` | |
```pseudo |
|
||
- `strings` is a well-formed template literal array object. | ||
- `Sub1,...,subN` Contains substitution values. | ||
- `templateString` is a template literal. |
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.
- `strings` is a well-formed template literal array object. | |
- `Sub1,...,subN` Contains substitution values. | |
- `templateString` is a template literal. | |
**Parameters:** | |
- `strings`: Array-like object with a `.raw` property holding raw string segments. | |
- `sub1, ..., subN` (optional): Values for `${}` placeholders in the template. | |
- `templateString` (required when using tagged syntax): A template literal passed to `String.raw`. |
## Example | ||
|
||
```js | ||
String.raw`Hi\n${name}!`; |
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.
have a name variable with a value, and also showcase the output in a separate shell
block
String.raw`Hi\n${2 + 3}!`; | ||
//Returns 'Hi\n5!' |
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.
String.raw`Hi\n${2 + 3}!`; | |
//Returns 'Hi\n5!' | |
console.log(String.raw`Hi\n${2 + 3}!`); |
Closing the PR due to author inactivity |
Description
Issue Solved
Closes #6961
Type of Change
Checklist
main
branch.Issues Solved
section.