can i write this function without brackets in variable? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

can i write this function without brackets in variable?

function print(x) { return x-7 } var print1=print console.log(print1(3))

24th Sep 2021, 6:08 AM
Aniket Ganguly
11 Answers
+ 2
Why ask a question with an obvious answer?
24th Sep 2021, 6:21 AM
Solo
Solo - avatar
+ 2
Vasiliy Obvious question? I suppose you have an obvious answer?
24th Sep 2021, 6:39 AM
Ipang
+ 2
Vasiliy Already done
24th Sep 2021, 7:26 AM
Ipang
+ 1
Ipang print1
24th Sep 2021, 6:26 AM
Aniket Ganguly
0
I didn't get your question ... Do you want to call print1() or print() ??? * The snippet in Description had been modified from the original.
24th Sep 2021, 6:19 AM
Ipang
0
Ipang I'm surprised that you don't have it. 😕
24th Sep 2021, 6:58 AM
Solo
Solo - avatar
0
Vasiliy That means you do then?
24th Sep 2021, 7:01 AM
Ipang
0
Ipang I do not know English well and did not understand your question, reformulate the question.
24th Sep 2021, 7:14 AM
Solo
Solo - avatar
0
Vasiliy You said you were surprised I don't have any answer to the OP's question. Do you have the answer?
24th Sep 2021, 7:16 AM
Ipang
0
Ipang open javascript and make sure the Aniket Ganguly code works.
24th Sep 2021, 7:25 AM
Solo
Solo - avatar
- 1
Aniket Use of arrow function may help const print = ( x ) => x - 7; let print1 = print; console.log( print1( 49 ), print( 49 ) );
24th Sep 2021, 6:42 AM
Ipang