From c264400794e2887487f1c8c2e39116a03f2c5092 Mon Sep 17 00:00:00 2001 From: Lan Hui <1348141770@qq.com> Date: Mon, 18 Jul 2022 12:02:15 +0800 Subject: [PATCH] User modern let to declare a variable. --- app/static/js/word_operation.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/static/js/word_operation.js b/app/static/js/word_operation.js index 3f83b07..39e8e72 100644 --- a/app/static/js/word_operation.js +++ b/app/static/js/word_operation.js @@ -1,12 +1,12 @@ function familiar(index) { - var username = $("#username").text(); - var word = $("#word_" + index).text(); - var freq = $("#freq_" + index).text(); + let username = $("#username").text(); + let word = $("#word_" + index).text(); + let freq = $("#freq_" + index).text(); $.ajax({ type:"get", url:"/" + username + "/" + word + "/familiar", success:function(resp){ - var new_freq = freq - 1; + let new_freq = freq - 1; if(new_freq <1) { $("#p_" + index).remove(); } else { @@ -17,22 +17,22 @@ function familiar(index) { } function unfamiliar(index) { - var username = $("#username").text(); - var word = $("#word_" + index).text(); - var freq = $("#freq_" + index).text(); + let username = $("#username").text(); + let word = $("#word_" + index).text(); + let freq = $("#freq_" + index).text(); $.ajax({ type:"get", url:"/" + username + "/" + word + "/unfamiliar", success:function(resp){ - var new_freq = parseInt(freq) + 1; + let new_freq = parseInt(freq) + 1; $("#freq_" + index).text(new_freq); } }); } function del_word(index) { - var username = $("#username").text(); - var word = $("#word_" + index).text(); + let username = $("#username").text(); + let word = $("#word_" + index).text(); $.ajax({ type:"get", url:"/" + username + "/" + word + "/del", @@ -40,4 +40,4 @@ function del_word(index) { $("#p_" + index).remove(); } }); -} \ No newline at end of file +}