I have the string "I love you, because you're funny" and have another 700 good attributes. Now, instead of putting those into the "I love you, because" format by hand, I want to write code that takes those 700 attributes, and makes a "I love you, because" sentence with each of it.
I have no idea how to do something like this, but I thought this'd be easy for most people here. Help is much appreciated!
This is what I have:
['funny', 'generous', 'smart'].map(s => `I love you, because you are ${s}`)
but I don't know how to let a program spit out the phrases, that I then can copy.
Problem resolved, thanks so much guys!
From your comment it seems you need further guidance. Below is a working example with comments to explain what each part does
// Array of attributes you want to have in each message
var loveMessageAttrinute = [
"funny",
"strong"
]
// The container you want to put this messages in
var loveMessageContainer = document.getElementById("LoveMessages");
// for each attribute in your array get on attribute at a time
// it will first get "funny" then after it appends and add the message to the container it gets the next attribute "strong" and so on
loveMessageAttrinute.forEach((attr) => {
// append the attribute to the message
var message = `<p>I love you because you are ${attr}<p/>`
// put the message to the container
loveMessageContainer.innerHTML += message;
});
<div id="LoveMessages">
</div>