Skip to content

[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

Closed
wants to merge 7 commits into from
Closed

Conversation

SolidRenner
Copy link

@SolidRenner SolidRenner commented Jun 10, 2025

Description

Issue Solved

Closes #6961

Type of Change

  • Adding a new entry
  • Editing an existing entry (fixing a typo, bug, issues, etc)
  • Updating the documentation

Checklist

  • All writings are my own.
  • My entry follows the Codecademy Docs style guide.
  • My changes generate no new warnings.
  • I have performed a self-review of my own writing and code.
  • I have checked my entry and corrected any misspellings.
  • I have made corresponding changes to the documentation if needed.
  • I have confirmed my changes are not being pushed from my forked main branch.
  • I have confirmed that I'm pushing from a new branch named after the changes I'm making.
  • I have linked any issues that are relevant to this PR in the Issues Solved section.

@SolidRenner SolidRenner changed the title Added term raw() in Javascript Terms. [Edit] Javascript: raw() Jun 10, 2025
@mamtawardhani mamtawardhani self-assigned this Jun 11, 2025
@mamtawardhani mamtawardhani added javascript JavaScript entries new entry New entry or entries status: under review Issue or PR is currently being reviewed labels Jun 11, 2025
@SolidRenner
Copy link
Author

Did I meet the requirements?

Copy link
Collaborator

@mamtawardhani mamtawardhani left a 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! 😃

Comment on lines +2 to +11
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'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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'
---

Copy link
Collaborator

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

```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```
```pseudo

Comment on lines +21 to +24

- `strings` is a well-formed template literal array object.
- `Sub1,...,subN` Contains substitution values.
- `templateString` is a template literal.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `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}!`;
Copy link
Collaborator

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

Comment on lines +36 to +37
String.raw`Hi\n${2 + 3}!`;
//Returns 'Hi\n5!'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
String.raw`Hi\n${2 + 3}!`;
//Returns 'Hi\n5!'
console.log(String.raw`Hi\n${2 + 3}!`);

@mamtawardhani
Copy link
Collaborator

Closing the PR due to author inactivity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Term Entry] JavaScript Strings: raw()
2 participants