How to test your javascript solutions

For example I just want to see what the output of this is … but it just evaluates it without giving me what i am trying to display so i can test and modify my code. the console.log is not showing me anything.
I dont want a solution to the question , I just want to know how do I print my test results using console.log

function palindrome(str) {
// Good luck!
var origStr = str;
var strp = str.replace(/[^A-Za-z]/,’’);
console.log(strp);
if(strp.reverse == origStr){
return true ;
}
return false;
}
palindrome(“eye”);

Where do you run your code? If you ran your code on the browser it should print on the console.

Or you can try repl.it

You need to have your browser’s console open to see the result of console.log calls. How you do that depends on the browser. For example, in Chrome it’s: Command+Option+J for Mac or Control+Shift+J for Windows and Linux.

Google “console shortcut” with the name of your browser to find the shortcut for your browser.

Thanks. this works! I really appreciate your help

Not sure how to try it here. i chose javascript and copy pasted that snippet, didnt do much… It prints out in my browser console… thanks

That’s weird. repl.it is pretty reliable. Did you get any error messages when you ran your code?