I don't understand what you are asking now. I already gave you the answer why the code in the OP didn't work. Here's your code, properly cleaned up:
https://jsfiddle.net/ph4fxtd1/20/
It's quite obvious that you'll need to put this into a function if you want to run this more than once, and there would be nothing recursive about it. Consider finding a book or a good tutorial on javascript and/or programming in general. Once you understand the basic concepts it will make things much easier for you in the future. Good luck!
edit: I'll add the cleaned up code here as well in case somebody comes looking for this in the future when the linked fiddle has gone away:
Code: Select all
var DB = [
['hello', 'world'],
['goodbye','dave']
];
var search = prompt('query:');
for (var i = 0, len = DB.length; i < len; i++) {
if (search == DB[i][0]) {
prompt(DB[i][1]);
} else {
prompt('could not locate');
}
}