Im new to js and its sometimes hard for me to get used to its code conventions. So i have a question, how i should declare function expression? Look at my code, is it right how i did it, or there are better practices?
function onAddButtonClick() { var engWord = document.getElementById('engWord'), japWord = document.getElementById('japWord'), engVal = engWord.value, japVal = japWord.value, engExpr = (engVal !== ""), japExpr = (japVal !== ""), duplicateNum, checkImg, numOfWords; duplicateNum = (function () { var i, pair; for (i = 0; i < dictionary.length; i++) { pair = dictionary[i]; if (pair.eng === engVal && pair.jap === japVal) { return 3; } else if (pair.jap === japVal) { return 2; } else if (pair.eng === engVal) { return 1; } } return 0; }()); //remove focus from inputs engWord.blur(); japWord.blur(); ... } Thanks in advance.