Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
367 views
in Technique[技术] by (71.8m points)

keeping getting an undefined error in Javascript not sure how to fix it

//basic html 
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <title>Bootstrap 101 Template</title>

    <!-- Bootstrap -->
    <link href="css/bootstrap.min.css" rel="stylesheet">

  </head>
  <body>
    <h1>Hello, world!</h1>
 okay  
 
     <script src="script.js"></script>
     <script src="script2.js"></script>
      <script src="app.js"></script>
    <script src="js/bootstrap.min.js"></script>
  </body>
</html>

//JS code

var yaakovGreeter = {};
var greeting = "Hi";
yaakovGreeter.name = "Yaakov";
yaakovGreeter.sayHello = function   ()  {
  console.log("greeting" + yaakovGreeter.name);
  
  }
  
(function (window)  {
    var johnGreeter = {};
     johnGreeter.name = "John";
     var greeting = "Hi"  "; 
     johnGreeter.sayHi = function ( )  {
     console.log(greeting +  johnGreeter.name);
  
        window.johnGreeter = johnGreeter;
  
  } )(window);


    yaakovGreeter.sayHello( );
    johnGreeter.sayHi( );

this is an project have to define names using JS. please help

trying to define names using JS code only. I keep getting this error message saying one name cannot be defined tried different ways to fix it but error keeps showing need help with understanding how to fix error.

question from:https://stackoverflow.com/questions/65877970/keeping-getting-an-undefined-error-in-javascript-not-sure-how-to-fix-it

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...