extraArgs outputting to console log with NaN
NickName:rds80 Ask DateTime:2020-12-20T23:42:42

extraArgs outputting to console log with NaN

I'm following a tutorial and the code below is outputting Extra Arg: NaN. I'm not sure why that's the case and I even tried extraArgs[i].toString().

let myFunc = function (name, weather,...extraArgs) {
    console.log("Hello " + name + ".");
    console.log("It is " + weather + " today");
    for (let i=0; i < extraArgs.length; i++) {
        console.log("Extra Arg: ", + extraArgs[i]);
    }
};

myFunc("Adam", "sunny","one", "two", "three");

Copyright Notice:Content Author:「rds80」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/65381660/extraargs-outputting-to-console-log-with-nan

More about “extraArgs outputting to console log with NaN” related questions

extraArgs outputting to console log with NaN

I'm following a tutorial and the code below is outputting Extra Arg: NaN. I'm not sure why that's the case and I even tried extraArgs[i].toString(). let myFunc = function (name, weather,...

Show Detail

jQuery outputting NaN

For some reason the code is outputting NaN on the website, but its working on the fiddle. Here is the code: $(document).ready(function() { var arrTotals = []; var totalAmount = 0; $( ".cartpr...

Show Detail

async and nodes js function console.log recieves NaN, NaN, Nan need help outputting the the string out as a string and not a number

full code and the error I m getting below I would really like to get the output working correctly so I can move on in my code var app = require('express')() , server = require('http').

Show Detail

jquery console log object changes zero to NaN

This is the output of the chrome (59.0.3071.115) console. How is it possible that same key has different values (0 and NaN)? this also stays when I .log variable and JSON.parse result separately.

Show Detail

Getting NaN when console.log()

I'm doing a project/game in HTML/JavaScript with a console, and I'm putting in "ping" in it. But when I run this code I just get "NaN". function ping(IP){ for (var i = 0; i &lt;= 3; i++) {&

Show Detail

console.log() not outputting HTML of jQuery selection object

I got a problem when using console.log in Google Chrome. Suddenly when I was outputting a element like $(this) it was display like: [&lt;div&gt;, context: &lt;div&gt;] or [jQuery.fn.jQuery.init[...

Show Detail

Why JS object console log gives NaN instead of Number?

From .NET backend we receive by GET method to Google Chrome an object Delivery { Id: 1, ShippingDateTime: null, ApproximateHandoverDateTime: null, Charge: 527, Cost: null } If we look at...

Show Detail

console.log(-1) still returns NaN

I have my js code for homework here. I have an if statement that should return -1 in console when the input is not a number but instead of returning -1 it returns NaN. Can anybody help me with this?

Show Detail

Node Express Middleware outputting console.log() twice from one call?

just a quick question about some Node + Express middleware that is outputting 1 call to console.log twice in my node cmd prompt. It just doesn't make sense and was wondering if someone could expla...

Show Detail

A function with a console log output inside console.log prints undefined

function haha(){ console.log('haha'); } console.log(haha()); Prints: haha undefined Is it because if you don't specify return in a function it will return undefined and this is what the sec

Show Detail