A
A
Alexander Shtang2015-07-19 09:04:18
css
Alexander Shtang, 2015-07-19 09:04:18

What is the problem with the second variable?

Here are two variables:

var greeting = function (name) {
            console.log("Great to see you," + " " + name);
        };
        greeting("Alex");
        
        var someName = function (name) {
            console.log("Hello," + " " + someName + "!");
        };
        someName("Alex");

And here are their results:
  1. Great to see you, Alex
  2. Hello, function (name) {
    console.log("Hello," + " " + someName + "!");
    }!

I checked the syntax (although there is nothing to check here), what have I not understood yet?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stalker_RED, 2018-12-03
@kachurinets

It looks like your screenshot is not blurring, but just a white block with about 70% transparency on top of the content.

N
Nazar Mokrinsky, 2015-07-19
@Enclave88

Well, you are trying to print a function, so it worked someName.toString()
. As I understand it, you just need to put name in the second case too:

var greeting = function (name) {
    console.log("Great to see you, "+ name);
};
greeting("Alex");

var someName = function (name) {
    console.log("Hello, " +name + "!");
};
someName("Alex");

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question