Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

197
Views
I created a function in ReactJs but it's not working

Code:

 import './App.css';

function App() {
  const firstName = 'Toto';
  const lastName = 'Wolff';
  const age = 35;
  const job = 'Principal';

  const getFullName = (firstName,
    lastName) => '${firstName} ${lastName}'

  return (
    <div className="App">
      <h3>Full Name: {getFullName(firstName,
        lastName)} </h3>
      <p>Age : {age}</p>
      <p>Job : {job}</p>
    </div>
  );
}

export default App;

Output:

Full Name: ${firstName} ${lastName}
Age : 35
Job : Principal
about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

You are mixing syntax. Template strings require backticks.

`${firstName} ${lastName}`

If you want to use single quotes

firstName + ' ' + lastName

about 4 years ago · Juan Pablo Isaza Report

0

Your code is fine its just you used single quotes '' instead of backquotes `` here

 const getFullName = (firstName,
    lastName) => `${firstName} ${lastName}`

full code

import './App.css'

function App() {
  const firstName = 'Toto';
  const lastName = 'Wolff';
  const age = 35;
  const job = 'Principal';

  const getFullName = (firstName,
    lastName) => `${firstName} ${lastName}`

  return (
    <div className="App">
      <h3>Full Name: {getFullName(firstName,
        lastName)} </h3>
      <p>Age : {age}</p>
      <p>Job : {job}</p>
    </div>
  );
}
export default App;

see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals

about 4 years ago · Juan Pablo Isaza Report

0

You are using single quotes use backticks(Template literals) instead

const getFullName = (firstName,lastName) => `${firstName} ${lastName}`

Learn about template literals here

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!