Build a String Inspector - Step 11

Tell us what’s happening:

I can’t do step 11.
let endPunctuation = message.slice(-1);

console.log(The ending punctuation mark is a "${message.slice(-1)}".);

Your code so far

const fccSentence = "freeCodeCamp is a great place to learn web development.";

console.log("Here are some examples of the includes() method:");

const hasFreeCodeCamp = fccSentence.includes("freeCodeCamp");
console.log(`fccSentence.includes("freeCodeCamp") returns ${hasFreeCodeCamp} because the word "freeCodeCamp" is in the sentence.`);

const hasJavaScript = fccSentence.includes("JavaScript");
console.log(`fccSentence.includes("JavaScript") returns ${hasJavaScript} because the word "JavaScript" is not in the sentence.`);

const hasLowercaseFCC = fccSentence.includes("freecodecamp");
console.log(`fccSentence.includes("freecodecamp") returns ${hasLowercaseFCC} because includes is case-sensitive.`);

const message = "Welcome to freeCodeCamp!";

console.log("Here are some examples of the slice() method:");

const platform = message.slice(11, 23);
console.log(`The word "${platform}" was sliced from the message.`);

const greetingWord = message.slice(0, 7);
console.log(`The first word is "${greetingWord}".`);


// User Editable Region

let endPunctuation = endPuctuation.slice(-1);

console.log(`The ending punctuation mark is a "${endPunctuation.slice(-1)}".`);


// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36

Challenge Information:

Build a String Inspector - Step 11

you can’t use endPunctuation to the right of the = because it does not exist yet. What are you asked to use slice on instead?

The first time I wrote this, but says thats is wrong

let endPunctuation = message.slice(-1);

console.log(`The ending punctuation mark is a "${message.slice(-1)}".`);

that’s better, but now in the console.log you need to use the new variable you created, endPunctuation

let endPunctuation = message.slice(-1);

console.log(`The ending punctuation mark is a "${endPunctuation}".`);

I’ve edited your post to improve the readability of the code. When you enter a code block into a forum post, please precede it with three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add the backticks.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

and what do the tests say now? what appear in the console?

let endPunctuation = message.slice(-1);

console.log(`The ending punctuation mark is a “${endPunctuation}”.`);

its not working. It saying that is wrong. I did as the same as others, I don’t know what is wrong

you did not use backticks

what is it saying exactly?

1. You should declare a variable named endPunctuation.
2. Your endPunctuation variable should be a string.
5. Your endPunctuation variable should equal "!".
6. You should log the message The ending punctuation mark is a "<endPunctuation>", where <endPunctuation> should be replaced with the actual value of the variable.

can you share all the code you have in the editor please?

I used the backsticks

console.log(` The ending punctuation mark is a “${endPunctuation}”. `);

please use the backticks with code, not with text

let endPunctuation = message.slice(-1);
console.log(“The ending punctuation mark is a “” + endPunctuation + “”.”);

can you post all the code you have in the editor, including the one on the first few lines above the instructions?

const fccSentence = "freeCodeCamp is a great place to learn web development.";



console.log("Here are some examples of the includes() method:");



const hasFreeCodeCamp = fccSentence.includes("freeCodeCamp");

console.log(`fccSentence.includes("freeCodeCamp") returns ${hasFreeCodeCamp} because the word "freeCodeCamp" is in the sentence.`);



const hasJavaScript = fccSentence.includes("JavaScript");

console.log(`fccSentence.includes("JavaScript") returns ${hasJavaScript} because the word "JavaScript" is not in the sentence.`);



const hasLowercaseFCC = fccSentence.includes("freecodecamp");

console.log(`fccSentence.includes("freecodecamp") returns ${hasLowercaseFCC} because includes is case-sensitive.`);



const message = "Welcome to freeCodeCamp!";



console.log("Here are some examples of the slice() method:");



const platform = message.slice(11, 23);

console.log(`The word "${platform}" was sliced from the message.`);



const greetingWord = message.slice(0, 7);

console.log(`The first word is "${greetingWord}".`);

let endPunctuation = message.slice(-1);

console.log(`The ending punctuation mark is a "${message.slice(-1)}".`);

I’ve edited your post to improve the readability of the code. When you enter a code block into a forum post, please precede it with three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add the backticks.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

I only see this failure with your code:

You should log the message The ending punctuation mark is a "<endPunctuation>" , where <endPunctuation> should be replaced with the actual value of the variable.

double check you are using the correct message (check your punctuation)

let endPunctuation = message.slice(-1);

console.log(`The ending punctuation mark is a “${endPunctuation}”.`);

are you checking your punctuation?