TutorMe homepage
Subjects
PRICING
COURSES
SIGN IN
Start Free Trial
Harshal J.
Senior Software Developer since last 10 years
Tutor Satisfaction Guarantee
Javascript Programming
TutorMe
Question:

const b = [1, 2, 3]; const f = (a, ...b) => a + b; console.log(f(1));

Harshal J.
Answer:

The answer is '1'. The trick is that due to duplicate declaration of b as variable and parameter, it gets resolved as parameter. Since we call our function only with 1 parameter – 1 + [] equals '1'. Pay attention that type of returned value is string.

Computer Science (General)
TutorMe
Question:

What is the difference between Architectural style, Architectural patterns and design patterns ?

Harshal J.
Answer:

An Architectural Style is the application design at the highest level of abstraction; An Architectural Pattern is a way to implement an Architectural Style; A Design Pattern is a way to solve a localised problem.

C Sharp Programming
TutorMe
Question:

I have the following class: public class Point { public int X { get; set; } public int Y { get; set; } public Point(int xPos, int yPos) { X = xPos; Y = yPos; } } Also, I have 3 instances of the class. Will the following initialization of the third instance work? If it won’t, what should be done? Point ptOne = new Point(15, 20); Point ptTwo = new Point(40, 50); Point ptThree = ptOne + ptTwo;

Harshal J.
Answer:

Of course, the example will not work. To make this code work, we need to add the addition operator overloading to the Point class. For example, the following one: public static Point operator +(Point p1, Point p2) { return new Point(p1.X + p2.X, p1.Y + p2.Y); }

Send a message explaining your
needs and Harshal will reply soon.
Contact Harshal
Ready now? Request a lesson.
Start Session
FAQs
What is a lesson?
A lesson is virtual lesson space on our platform where you and a tutor can communicate. You'll have the option to communicate using video/audio as well as text chat. You can also upload documents, edit papers in real time and use our cutting-edge virtual whiteboard.
How do I begin a lesson?
If the tutor is currently online, you can click the "Start Session" button above. If they are offline, you can always send them a message to schedule a lesson.
Who are TutorMe tutors?
Many of our tutors are current college students or recent graduates of top-tier universities like MIT, Harvard and USC. TutorMe has thousands of top-quality tutors available to work with you.