JavaScript: Check if a Variable Contains '```'
Here is an example code to check if a variable text is '``` ' in JavaScript:
if (text === '``` ') {
console.log('Variable text is equal to '``` ');
} else {
console.log('Variable text is not equal to '``` ');
}
This code uses the strict equality operator (===) to compare the variable text with the string ' '. If they are equal, the code will log a message saying that the variable text is equal to ' '. If they are not equal, the code will log a message saying that the variable text is not equal to '``` '.
原文地址: https://www.cveoy.top/t/topic/mF7u 著作权归作者所有。请勿转载和采集!