Is it possible to add different numbers inside one variable?
Example:
$( ".list .task" ).each( function( ){
var GetScore = $( this ).text();
console.log(GetScore);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="list">
<div class="task">1</div>
</div>
<div class="list">
<div class="task">2.2</div>
</div>
<div class="list">
<div class="task">4</div>
</div>
<div class="list">
<div class="task">9.3</div>
</div>
Like this way I get the numbers in one variable, but how can I add them now? Or is it necessary to make a variable for every ".task"
number?