Click here to Skip to main content
15,887,214 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
AnswerRe: I go down rabbit holes on Wiki following internal combustion tech for some reason. Pin
sasadler26-Oct-23 6:23
sasadler26-Oct-23 6:23 
AnswerRe: I go down rabbit holes on Wiki following internal combustion tech for some reason. Pin
Choroid26-Oct-23 6:43
Choroid26-Oct-23 6:43 
AnswerRe: I go down rabbit holes on Wiki following internal combustion tech for some reason. Pin
jkirkerx26-Oct-23 7:08
professionaljkirkerx26-Oct-23 7:08 
AnswerRe: I go down rabbit holes on Wiki following internal combustion tech for some reason. Pin
englebart26-Oct-23 8:05
professionalenglebart26-Oct-23 8:05 
AnswerRe: I go down rabbit holes on Wiki following internal combustion tech for some reason. Pin
bryanren26-Oct-23 8:38
bryanren26-Oct-23 8:38 
GeneralRe: I go down rabbit holes on Wiki following internal combustion tech for some reason. Pin
Alister Morton30-Oct-23 5:22
Alister Morton30-Oct-23 5:22 
AnswerRe: I go down rabbit holes on Wiki following internal combustion tech for some reason. Pin
Jacquers28-Oct-23 23:02
Jacquers28-Oct-23 23:02 
QuestionHow did you survive this migration? Pin
Nand3225-Oct-23 1:01
Nand3225-Oct-23 1:01 
As a traditional (non-script) developer, who always starts the code with proper class, methods etc in C++/Java,

class ApiClient
{
   ApiClient(){}
getSomething(){}
putSomething(){}
}


This always looked so clean for my eyes..


Now compare it with JS/Typescript code :

class ApiClient {
  public get(apiURL: string): Promise<any>{
  
    return new Promise((resolve, reject) => {
      const options = {
        method: 'GET',
        headers: {
          'Content-Type': 'application/json',
          // Add any other headers as needed
        },
      };

      const request = http.request(apiURL, options, (response) => {
        let data = '';

        response.on('data', (chunk) => {
          data += chunk;
        });

        response.on('end', () => {
          if (response.statusCode === 200) {
            const responseData = JSON.parse(data);
            resolve(responseData);
          } else {
            reject(new Error(`Error: ${response.statusCode}, Response: ${data}`));
          }
        });
      });

      request.on('error', (error) => {
        reject(error);
      });

      request.end();
    });
  }
}



Why do they want to write the whole code into the ()?
It's almost like writing all the code inside (..) in a C++ function.. where we just expect the params & arguments.
like:
ApiClient(.....Write the whole code here? What? :( ){}


Seriously I have so much pain tracking where the brackets begin and end if I'm reviewing a .js code snippet.

Did C++/Java also move into this Anonymous function hype?

Looks like I'll have a pretty steep learning curve on any direction. Hating this. Hmmm | :|
How did you survive this? If you happen to a non-JS developer migrating into the JS world?
AnswerRe: How did you survive this migration? Pin
11917640 Member 25-Oct-23 2:26
11917640 Member 25-Oct-23 2:26 
AnswerRe: How did you survive this migration? Pin
Amarnath S25-Oct-23 2:56
professionalAmarnath S25-Oct-23 2:56 
GeneralRe: How did you survive this migration? Pin
MarkTJohnson25-Oct-23 3:01
professionalMarkTJohnson25-Oct-23 3:01 
AnswerRe: How did you survive this migration? Pin
honey the codewitch25-Oct-23 2:56
mvahoney the codewitch25-Oct-23 2:56 
GeneralRe: How did you survive this migration? Pin
Alister Morton25-Oct-23 23:26
Alister Morton25-Oct-23 23:26 
AnswerRe: How did you survive this migration? Pin
raddevus25-Oct-23 3:18
mvaraddevus25-Oct-23 3:18 
GeneralCCC 25-10-2023 Pin
pkfox24-Oct-23 22:04
professionalpkfox24-Oct-23 22:04 
GeneralRe: CCC 25-10-2023 Pin
OriginalGriff24-Oct-23 22:18
mveOriginalGriff24-Oct-23 22:18 
GeneralRe: CCC 25-10-2023 Pin
DerekT-P24-Oct-23 23:13
professionalDerekT-P24-Oct-23 23:13 
GeneralRe: CCC 25-10-2023 - Winner Pin
pkfox24-Oct-23 23:29
professionalpkfox24-Oct-23 23:29 
GeneralWordle 858 Pin
GKP199224-Oct-23 17:43
professionalGKP199224-Oct-23 17:43 
GeneralRe: Wordle 858 Pin
Shane010324-Oct-23 18:04
Shane010324-Oct-23 18:04 
GeneralRe: Wordle 858 Pin
OriginalGriff24-Oct-23 19:17
mveOriginalGriff24-Oct-23 19:17 
GeneralRe: Wordle 858 Pin
Amarnath S24-Oct-23 20:00
professionalAmarnath S24-Oct-23 20:00 
GeneralRe: Wordle 858 Pin
GuyThiebaut24-Oct-23 20:06
professionalGuyThiebaut24-Oct-23 20:06 
GeneralRe: Wordle 858 Pin
Sander Rossel24-Oct-23 20:27
professionalSander Rossel24-Oct-23 20:27 
GeneralRe: Wordle 858 Pin
ChandraRam24-Oct-23 20:38
ChandraRam24-Oct-23 20:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.