Skip to content

CodeSpace-Academy/Module_1_StudentNo_Classcode_Group_Name-Surname_JSL01

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

[JSL01] Submission: Syntax-Engine Interaction Challenge

You will:

  1. Use the Starter Code Repo,
  2. Code your solution,
  3. Commit changes to your repo
  4. Submit GitHub Repo Link to LMS [JSL01] Submission Project Tab

Imagine you are building a virtual pet adoption website, and you need to create a JavaScript function that checks if the user has entered valid pet adoption details. Write a function that takes a string as input and validates if it follows a specific syntax, such as starting with "pet_" followed by a combination of letters and numbers. If the input follows the syntax, return "Valid Syntax," otherwise, return "Invalid Syntax."

alt text

Challenge Instructions

  1. In the script.js file, complete the validateSyntax function to check if the input string starts with "pet_" and is followed by a combination of letters and numbers.
  2. If the input follows the correct syntax, set result to "Valid Syntax." Otherwise, set it to "Invalid Syntax."
  3. Test your function by entering different strings in the input box and clicking the validate button.

How to Test

  • Run the index.html challenge in a browser.
  • Enter different pet adoption details in the input box and click the validate button to see the results.
  • Make sure your solution works for a variety of inputs.
  • Open the console and debug your code until there are no errors.

Instructions for Running the Code

  1. Save the HTML, CSS, and JavaScript files in a folder.
  2. Open the folder in VSCode.
  3. Right-click on index.html and open with a browser (use Live Server if available).
  4. Modify the script.js file to correct the syntax errors and save the file.
  5. Refresh your browser to view the changes.

This challenge helps students practice basic string manipulation and validation in JavaScript, along with simple DOM manipulation to create an interactive and user-friendly interface.

Check out the practice challenges on Scrimba here: https://scrimba.com/playlist/pqPae6ZH7

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published