//create a function that takes a url query string as an argument
function checkQueryString(url) {
//check if the url query string exists
if (url.indexOf("?") !== -1) {
//if it exists display it on the page with comments
console.log("The query string exists.");
} else {
//if it does not exist display it on the page with comments
console.log("The query string does not exist.");
}
}
//example
const url = "https://www.codecademy.com/learn";
checkQueryString(url);
//output
//The query string exists.
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)