简体   繁体   English

Javascript和空白网页

[英]Javascript and a Blank Web Page

I'm struggling to initialize a function in JavaScript. 我正在努力用JavaScript初始化函数。 I'm fairly new to it, and can't seem to see the problem in my code. 我对此很陌生,似乎无法在我的代码中看到问题。 Every time I test it, I just see a blank web page. 每次测试时,我只会看到一个空白网页。 Here's a snippet of the code where I think the problem is: 这是我认为问题所在的代码段:

function initialize(){
    cities();
};

//function to create a table with cities and their populations
function cities(){
    //define two arrays for cities and population
        var cityPop = [
            { ...

I've looked through lessons on codecademy, and been browsing around for answers but can't seem to figure it out. 我浏览了有关代码学院的课程,并一直在寻找答案,但似乎无法弄清楚。 Any advice? 有什么建议吗?

You have to call the initialize function also which will call the cities function 您还必须调用initialize函数,这将调用citys函数

function initialize(){
    cities();
};

//function to create a table with cities and their populations
function cities(){
    //define two arrays for cities and population
        var cityPop = [
            { ...}]
}
initialize();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM