PatrickFrankAIU / ITWEB220-2404A

Learning resources for students in ITWEB 220, term 2404A.
0 stars 0 forks source link

Exercise: Display a String by Individual Characters #4

Open PatrickFrankAIU opened 3 months ago

PatrickFrankAIU commented 3 months ago

For this exercise you're reporting each character in a string, one output line at a time, like this:

First Character: P Second Character: a Third Character: t

To create this program, prompt the user to enter a string, such as their name, or a sentence. Then write code to print the first five characters of that string.

Tip: Use the string index, such as var1[0] (assuming you called your variable "var1"), to retrieve the character in a specific location in the string. Alternatively, you can use the built-in JavaScript function "var1.charAt()", placing the index number into the parentheses when you call it.

When you are finished, commit and sync your code to your folder, and be sure to let the instructor know. (Tip: Create a new file in your folder for each Issue exercise so that you can refer back to them quickly later!)