JavaScript as a Girlfriend

JavaScript as a Girlfriend [Part One]

Imagine Javascript as a girlfriend of yours :)

I will tell you What your relationship will be like with her?

What are the types of things she loves to do?

What types of things can you do with her?

And How can you date her?

Let’s Started the Journey with your new Relationship with JS

— First of all, I want to share her owner’s name is Brendan Eich. He built her in nearly 1995. This man reason of her all abilities

Her first name was LiveScript then they change the name her and we fall in love with Javascript

As a Girlfriend, she is a multi-paradigm, dynamic language with types and operators, standard built-in objects, and methods. Its syntax is based on the Java and C languages.

She also supports object-oriented programming with object prototypes, instead of classes and She supports functional programming — because they are objects, functions may be stored in variables and passed around like any other object.

That’s Cool right? She supports Functional Programming and OOP both. This is one reason you have love her Dude

She designed the scripting language and it is up to the host environment to provide mechanisms for communicating with the outside world. The most common host environment is the browser, but JavaScript can interpreters other places also, including Adobe Acrobat, Adobe Photoshop, SVG images, Yahoo’s Widget Engine, server-side environments such as NoteJS, NoSQL databases like the open-source Apache CouchDB

Actually, she works with many things :

  • Number
  • String
  • Boolean
  • Symbol
  • Object
  • Functions
  • Array
  • Date
  • RegExp
  • Null
  • Undefined
  • error

In General, life if you have $5 you will store your money to your pocket but do you know your Girlfriend means JS will not store 5 dollars in the pocket she will store in a variable

Pocket = Variable;

Her pocket has many names like your pocket front-pocket back pocket also shirt pocket ;)

Her pocket or variable has many types like Let, const, var

You gave her 5 dollar means she will store

-const pocket = 5

She stores 5 dollars her one pocket name const,

Const pocket money will not change

Let money will change

Var as like a common pocket

Play with number :

If you give her an infinity number like this

1 / 0; // Infinity

-1 / 0; // -Infinity

She can know it is infinity or not by isInfinity();

isFinite(1 / 0); // false

isFinite(-Infinity); // false

Play with Strings:

If you tell her I love you JS

Then do you know what she will do?

She will convert it by number as like this

“I love you JS”.length() // 13

She can also do this

“I,love,you,JS”.replace(“love”,”hate”) // I hate you JS

Look her power what she can do if she don’t like you

She can uppercase your sentence also

““I love you JS”.toUpperCase() // I LOVE YOU JS;

She can Also add String Number

let s1 = ‘2 + 2’ // creates a string primitive

let s2 = new String(‘2 + 2’) // creates a String object

console.log(eval(s1)) // returns the number 4

console.log(eval(s2)) // returns the string “2 + 2”

Other Things is ChatAt

var anyString = ‘I Love you JS’;

console.log(“The character at index 0 is ‘“ + anyString.charAt() + “‘“);

// No index was provided, used 0 as default

console.log(“The character at index 0 is ‘“ + anyString.charAt(0) + “‘“);

console.log(“The character at index 1 is ‘“ + anyString.charAt(1) + “‘“);

console.log(“The character at index 2 is ‘“ + anyString.charAt(2) + “‘“);

console.log(“The character at index 3 is ‘“ + anyString.charAt(3) + “‘“);

console.log(“The character at index 4 is ‘“ + anyString.charAt(4) + “‘“);

console.log(“The character at index 999 is ‘“ + anyString.charAt(999) + “‘“);

//PutPut Of chatAt();

The character at index 0 is ‘I’

The character at index 0 is ‘I’

The character at index 1 is ‘’

The character at index 2 is ‘L’

The character at index 3 is ‘O’

The character at index 4 is ‘V’

The character at index 5 is ‘E’

The character at index 999 is ‘’

The concat() method concatenates the string arguments to the calling string and returns a new string:

let propose= ‘Hello JS ‘

console.log(propose. Concat(I, ‘Love you have a nice day.’))

// Hello Js I Love you have a nice day.

Look Concat fulfills your Speech.

The substring() method

let propose= ‘I love you JS’ ;

console.log(propose.substring(1,5) //love;

The includes() method

If you propose to her she can check you love her or don’t love her?

const sentence = ‘I Love you JS’;

const word = ‘JS’;

console.log(`The word “${word}” ${sentence.includes(word) ? ‘is’ : ‘is not’} in the sentence`);

// expected output: “The word “JS” is in the sentence”

Play with operators:

She can play with the number and also your money

Remember you gave her 5 dollars and she stored it?

Money += 5; // 10 Dollar Now

Money = Money + 5; //10 Dollar Now

If she wants she can increase your money also she can decrease your money like this also

Let Money = 10;

Let Money -= 5; //5 dollar now

Let Money = Money — 5; //0 Dollar Now

See she can decrease your 5 dollar dude don’t upset she will make money

She has the power to reduce your sadness Like this:

const sadness = “I'm” + Money + “ % Sad Now”;

//I'm 0 % sad now;

Look she has the power to make you — Love her Dude ;)

Control Structures:

She can control yourself by controlling method like this

var talkWithGirls= true;

if (talkWithGirls == true) {

alert“One Slap in you face”

} else {

alert(“She will love you a lot ”);


Look She can Control you ;) You will not talk with other girls for her slap

She also has: for a loop. while loop, do-while loop, and Switch

Play With Objects:

She has an Object to store lots of things like money and what did your say to her

-const store = {

Money: 0,

Said: “I Love You JS “


alert(store. Said) //I Love You JS

Look her Object stored all data of yours

Continue Day by Day………………………..

Web Developer and Designer