Search Text For Your Name (SOLVED)


#1

Hi everyone! I am working on the Search Text for Your Name project in the Javascript course. My code is below:

jshint multistr:true;
var text = "Use a Book Report Outline:  After reading the book, you are ready to start the writing process. In writing a book report, or any writing prompt, you’ll find writing easier if you follow the proven steps of the writing process: prewriting, writing, revising, editing, and publishing.  In the first step, prewriting, you’ll plan what you want to say. An outline is a great prewriting tool for book reports. Start your book report outline with the following five ideas. Each idea should correspond to a paragraph: 1. Introduction 2. Summary of Book  3. Book Details: Characters  4. Book Details: Plot  5. Evaluation and Conclusion  In organizing your thoughts, jot down a few ideas for each of these paragraphs. Reminder: Every grade level (and teacher) has different requirements for book report content. Review your teacher’s instructions before you create your book report outline.  Introductory Paragraph:  Most book reports begin with the basic information about the book: the book’s title, author, genre, and publication information (publisher, number of pages, and year published). The opening paragraph is also your opportunity to build interest by mentioning any unusual facts or circumstances about the writing of the book or noteworthy credentials of the author. Was the book a bestseller? Is the author a well-known authority on the subject? Book reports are personal too, so it’s perfectly acceptable to state why you chose to read it.  What’s the Book About?:  In the body of the book report—paragraphs 2, 3, and 4—you’ll describe what the book is about. This is your chance to show you’ve read and understood the book. Assuming you’ve read a fiction book, here are helpful writing tips:  Summary: Start this paragraph by writing an overview of the story, including its setting, time period, main characters, and plot. Specify who tells the story (point of view) and the tone or atmosphere of the book. Is it a creepy tale of suspense or a lighthearted adventure?  Character Details: In this paragraph, describe the main characters and identify the major conflict or problem the main characters are trying to solve. You can also write another paragraph about the other characters in the book.";
var myName = confirm("NAME");
var hitArray = [];
for(var i = 0; i < text.length; i++){
    if(text[i] === 'M'){
        for(var j = i; i === i + myName.length; i++){
            hitArray.push(i);
        }
    }
}
console.log(hitArray[0], hitArray[1], hitArray[2], hitArray[3], hitArray[4]);

I was doing fine until the last step (# 6 Log it!) when I get
SyntaxError: Unexpected identifier

I have tried lots of different things to change the code. Please help!
If you have an answer you can reply here or Blog Post


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.