Search a String Variable with JavaScript Methods

提供方
Coursera Project Network
在此指导 项目中,您将:

Write the JavaScript code to search through a string.

Compare JavaScript methods for searching through strings.

Use a JavaScript method to replace a value in a string.

Clock2 hours
Intermediate中级
Cloud无需下载
Video分屏视频
Comment Dots英语(English)
Laptop仅限桌面

In this intermediate-level project you will write JavaScript code to search through a string variable. You’ll use a variety of JavaScript methods to locate values within a string to determine whether they exist, find their position in the string, or even replace them with other values. The Notepad++ editor and Chrome browser are used to write inline JavaScript code and view the results. Note: This course works best for learners who are based in the North America region. We’re currently working on providing the same experience in other regions.

您要培养的技能

JavaScript replace()Javascript MethodsJavaScript search()StringsJava Syntax

分步进行学习

在与您的工作区一起在分屏中播放的视频中,您的授课教师将指导您完成每个步骤:

  1. Declare a JavaScript variable and assign to it a string value, while demonstrating string-handling techniques.

  2. Use the JavaScript includes() method to search through a string to determine whether it contains a string of characters.

  3. Search through a string using the JavaScript search() method with the goal of returning the position of the matching characters or set of characters.

  4. Search through a string with the JavaScript indexOf() method to return the first occurrence of a specific value.

  5. Search through a string with the JavaScript lastIndexOf() method to return the last occurrence of a specific value.

  6. Locate and replace a value in a JavaScript string using the replace() method.

指导项目工作原理

您的工作空间就是浏览器中的云桌面,无需下载

在分屏视频中,您的授课教师会为您提供分步指导

常见问题

常见问题

还有其他问题吗?请访问 学生帮助中心