man子手的麻烦^^ [英] Hangman troubles ^^

查看:66
本文介绍了man子手的麻烦^^的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

function

 displayToGues() {
    var 
holdLetters =""
;
    for
(i = 0; i < toGues.length; i++) {
        if
(toGues.charAt(i) == txtLetter.value.toUpperCase()) {
        holdLetters += txtLetter.value.toUpperCase();
        }
        else
 holdLetters += "_ "
;
     
    }
      divToGues = document.getElementById("divToGues"
);
      divToGues.innerHTML = holdLetters;
    }

推荐答案

您好,Miguel,

您需要发布更多代码.有一个隐含的字符串toGues来保存答案.字符串aantalLetters有点奇怪,因为假设将其初始化一次为空,则在您的示例中它将为"AA",然后为"AAJ".类似地,对于holdLetters(在每次迭代中都进行了显式初始化),其输出看起来更像是"________".和"_________".换句话说,除下划线外,什么都没有加,而且我们看不到您将如何获得提及的结果.由于有那么多的想像力,任何建议都是任意的.您最好通过下载其他示例来重新开始.

祝您好运!

Hi Miguel,

You would need to post more code. There's an implied string, toGues, holding the answer. The string aantalLetters is a bit strange because, assuming it's initialized once to empty, in your example it would be "AA", then "AAJ". Similarly for holdLetters, which gets explicitly initialized each iteration, it appears the output would be more like "________" and "_________". In other words, nothing but underscores is ever appended to it and we can't see how you'd get the results you mention.  With so much left up to the imagination, any advice would be arbitrary.  You might do better to start fresh by downloading a different example.

Best of luck!  


这篇关于man子手的麻烦^^的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆