DIV+CSS simulation of the class library of JS information box encountered a problem when there is no passing parameters in the past automatically use the hint information as the window title, the specific implementation of the following
Today to write a div+css analog JS information box class Library encountered a problem, I hope that when I did not pass the parameters of the past, automatically use the "prompt information" as the window title. I tried to write the code as follows: function MessageBox (title= "") {} No doubt I failed (otherwise I wouldn't have sent this blog) finally passed Baidu, found such a good thing code as follows: function Test (a ) {var b=arguments[0]?arguments[0]:50; Return a + ': ' +b; According to my humble understanding, arguments is probably something similar to an array, with the subscript starting from 0, which in sequence represents the parameters of the function, such as the arguments[0 in the example above, which means that argument a actually arguments[0]?arguments[0]:50 Can also be written as: Arguments[0] | | 50; The wording is quite concise. Above, is the method of setting the function parameter default value in JS