Procházet zdrojové kódy

LibJS: Remove unnecessary space character at the end of console.log()

Andreas Kling před 5 roky
rodič
revize
a94a150df0
1 změnil soubory, kde provedl 6 přidání a 3 odebrání
  1. 6 3
      Libraries/LibJS/Runtime/ConsoleObject.cpp

+ 6 - 3
Libraries/LibJS/Runtime/ConsoleObject.cpp

@@ -34,9 +34,12 @@ namespace JS {
 ConsoleObject::ConsoleObject()
 {
     put_native_function("log", [](Object*, const Vector<Value>& arguments) -> Value {
-        for (auto& argument : arguments)
-            printf("%s ", argument.to_string().characters());
-        printf("\n");
+        for (size_t i = 0; i < arguments.size(); ++i) {
+            printf("%s", arguments[i].to_string().characters());
+            if (i != arguments.size() - 1)
+                putchar(' ');
+        }
+        putchar('\n');
         return js_undefined();
     });
 }